开发者

Help Soap Response using ssl basic authentication and client certificates

Hello all I'm trying to issue a simple request to a protected wsdl and web service using ssl, client certificates and basic authentication.

Here's the code

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

and the working tested envelope using soapUI is:

<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>5971开发者_如何学运维1</idIssuer>
<paymentMode>1</paymentMode>
<Alias>666</idAlias>
<flag>0</flagPrivacy>
</asd:AddCustomer>
</soapenv:Body>
</soapenv:Envelope>

When i run my code I get this error:

method_missing': undefined method `AddCustomer' for #<Savon::Client:0x8abec08>


try printing out the following - or just do it in irb

client.wsdl.soap_actions

I'm guessing you'll see that AddCustomer is not one. It has probably been changed to something like add_customer.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜