Reputation: 13
In Savon 1, I could use the soap.input
to add xmlns
like following:
soap_client = Savon.client("http://pathtowsdl.com/a.svc?wsdl")
response = soap_client.request "AnAction" do
http.headers["soapAction"] = "AnAction"
soap.input = ["AnAction", {"xmlns" => "http://apathtosomething.com"}]
soap.body = {
"SomeAttribute" => "SomeValue"
}
end
In Savon 2, I can do client.call(:authenticate, message_tag: :authenticationRequest)
but how to add the xmlns
to the authenticationRequest
tag?
Upvotes: 1
Views: 2054
Reputation: 1332
#!/usr/bin/env ruby
require 'savon'
soap_client = Savon.client( endpoint: 'http://example.com',
namespace: 'http://v1.example.com')
soap_client.call(:authenticate,
message_tag: :authenticationRequest,
:attributes => { "xmlns" => "http://apathtosomething.com" })
outputs
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:wsdl="http://v1.example.com"
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Body>
<wsdl:authenticationRequest xmlns="http://apathtosomething.com">
</wsdl:authenticationRequest>
</env:Body>
</env:Envelope>
Upvotes: 1
Reputation: 3494
You have to add the attribute to the call, eg.
client.call('CreateRequest', :attributes => { 'xmlns' => 'xyz' })
Upvotes: 5