2009-11-14 31 views
0

我试图运行以下代码从ruby调用webservice,但得到一个错误'SSL not supported'。在Ruby中调用https Web服务时'SSL不支持'

我安装了httpclient 2.1.5.2。

require 'soap/wsdlDriver' 

def validate_certificate(is_ok, ctx) 
    cert = ctx.current_cert 
    unless (cert.subject.to_s == cert.issuer.to_s) #check the server certificate only 
    is_ok &&= File.open(file_name).read == ctx.current_cert.to_pem 
    end 
    is_ok 
end 

def test_webservice 
    wsdl = "https://.../service.wsdl" 
    driver = SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver 
    driver.options['protocol.http.ssl_config.verify_callback'] = method(:validate_certificate) 

    driver.method(params) 
end 
+0

也许您的Ruby安装没有内置SSL支持?查看适用于您的平台的安装文档。 –

+0

需要'openssl'=> true。 – user204884

回答