于公司用的是 ruby 1.8.7 的版本,现在要对接其他公司的 WebService,并且对方采用的是 https 协议,
require 'soap/wsdlDriver'
require 'soap/rpc/driver'
require 'soap/wsdlDriver'
require 'soap/mapping/wsdlencodedregistry'
require 'soap/mapping/mapping'
require 'soap/mapping/registry'
wsdl = 'https://192.168.1.106:1234/services/WSInterface?wsdl'
driver = SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
然后会报这样子的错误:
warning: peer certificate won't be verified in this SSL session
ignored attr: {http://schemas.xmlsoap.org/ws/2004/09/policy}PolicyURIs
ignored attr: {http://www.w3.org/2006/05/addressing/wsdl}Action
ignored element: {http://www.w3.org/2006/05/addressing/wsdl}UsingAddressing
ignored element: {http://schemas.xmlsoap.org/wsdl/soap12/}binding
ignored element: {http://schemas.xmlsoap.org/wsdl/soap12/}operation
ignored element: {http://schemas.xmlsoap.org/wsdl/soap12/}body
ignored element: {http://schemas.xmlsoap.org/wsdl/soap12/}fault
ignored element: {http://schemas.xmlsoap.org/wsdl/soap12/}address
ignored element: {http://schemas.xmlsoap.org/ws/2004/09/policy}Policy
C:/Ruby187/lib/ruby/1.8/wsdl/soap/methodDefCreator.rb:158:in `documentdefinedtype': part: parameters cannot be resolved (RuntimeError)
from C:/Ruby187/lib/ruby/1.8/wsdl/soap/methodDefCreator.rb:70:in `collect_documentparameter'
from C:/Ruby187/lib/ruby/1.8/wsdl/soap/methodDefCreator.rb:68:in `each'
from C:/Ruby187/lib/ruby/1.8/wsdl/soap/methodDefCreator.rb:68:in `collect_documentparameter'
from C:/Ruby187/lib/ruby/1.8/soap/wsdlDriver.rb:132:in `create_param_def'
from C:/Ruby187/lib/ruby/1.8/soap/wsdlDriver.rb:101:in `add_operation'
from C:/Ruby187/lib/ruby/1.8/xsd/namedelements.rb:58:in `each'
from C:/Ruby187/lib/ruby/1.8/xsd/namedelements.rb:57:in `each'
from C:/Ruby187/lib/ruby/1.8/soap/wsdlDriver.rb:96:in `add_operation'
from C:/Ruby187/lib/ruby/1.8/soap/wsdlDriver.rb:40:in `create_rpc_driver'
from his_webservice.rb:38:in `get_dept_arr'
from his_webservice.rb:48
如果采用 http 协议的话:
qqcode = "15445600"
wsdl = 'http://www.webxml.com.cn/webservices/qqOnlineWebService.asmx?wsdl'
## 获得web对象
driver = SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
### 调用对象的方法
ds = driver.qqCheckOnline(:qqCode=>qqcode)
这种调用是可以实际返回结果的 现在变为 https,不知道如何加入这个 ssl 认证,有没有高手指点一下,感谢