Savon multiple namespace in body

88 views
Skip to first unread message

mayank kumar

unread,
Mar 27, 2018, 6:17:28 AM3/27/18
to Savon
I am using Savon version 2 and asked this question on stackoverflow also, but didn't get any answer yet.
and passing wsdl url to the Savon.Client, and getting proper response in header, but I am not getting how to pass multiple namespace to the body:

Savon.client(wsdl: 'https://someUrl.com/abcd?wsdl', ssl_verify_mode: :none, pretty_print_xml: true, log: true, env_namespace: :soapenv) do
   wsse_auth
("api_demo_account", "somePassword", :digest)
end

client
.call(:operation_name, message: {
             
"api01Req" => [{"shipCode" => 'ABC', "shipAmount" => 1123,
                             
"countryCode" => "USA"}
                           
]},
             
'attributes' => { "xmlns" => "http://someUrl.com" })

and it is generating code for body like this:

<soapenv:Body>
 
<impl:operationName xmlns="http://someUrl.com">
 
<impl:api01Req>
   
<impl:shipCode>ABC</impl:shipCode>
   
<impl:shipAmount>1123</impl:shipAmount>
   
<impl:countryCode>USA</impl:countryCode>
 
</impl:api01Req>
 
</impl:operationName>
</soapenv:Body>

But I need a request like this:


<soapenv:Body>
 
<operationName xmlns="http://someURL.com">
 
<api01Req>
   
<ns1:shipCode xmlns:ns1="http://someOtherUrl.com">ABC
   
</ns1:shipCode>
   
<ns2:shipAmount xmlns:ns2="http://someOtherUrl.com">1123
   
</ns2:shipAmount>
   
<ns3:countryCode xmlns:ns3="http://someOtherUrl.com">USA
   
</ns3:countryCode>
 
</api01Req>
 
</getTotalPostage>
</soapenv:Body>

like here it is generating ns1, ns2, ns3, etc along with xmlns:ns1, xmlns:ns2, etc.. different URL's, how should I modify the code to get like above request.


Reply all
Reply to author
Forward
0 new messages