您好,我正在尝试使用ssl、客户端证书和基本身份验证向受保护的wsdl和web服务发出一个简单的请求。
这是密码
require 'savon'
client = Savon::Client.new "https://example.com/service?wsdl"
client.request.http.ssl_client_auth(
:cert => OpenSSL::X509::Certificate.new(File.read("cert.pem")),
:key => OpenSSL::PKey::RSA.new(File.read("key.pem")),
:verify_mode => OpenSSL::SSL::VERIFY_NONE
)
client.request.basic_auth "User", "Password"
response = client.AddCustomer |soap|
soap.body = {
:Channel => 0,
:tel => '34567',
:id => '597118125',
:paymentMode => 1,
:Alias => 666,
:flag => 0
}
puts response.to_xml
使用soapui的工作测试信封是:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mov="http://www.example.com/services/">
<soapenv:Header/>
<soapenv:Body>
<asd:AddCustomer>
<Channel>0</idChannel>
<tel>12344</msisdn>
<id>59711</idIssuer>
<paymentMode>1</paymentMode>
<Alias>666</idAlias>
<flag>0</flagPrivacy>
</asd:AddCustomer>
</soapenv:Body>
</soapenv:Envelope>
当我运行代码时,会出现以下错误:
method_missing': undefined method `AddCustomer' for