问题
I'm trying to setup a Savon's SOAP Envelope and can't figure out how to specify all the namespaces. I know how to add namespaces, but that's not what I'm looking for.
I'm using Savon 2.
回答1:
In Savon v2 you can add additional namespaces when you create the client. It has to be a Hash. The Documentation is here http://savonrb.com/version2/globals.html.
client = Savon.client(
:endpoint => 'https://www.example.com',
:namespace => 'urn:core.example.com',
:namespaces => { "xmlns:v2" => "http://v2.example.com",
"xmlns:v1" => "http://v1.example.com"},
:ssl_verify_mode => :none,
:log => true,
:log_level => :debug,
:pretty_print_xml => true
)
来源:https://stackoverflow.com/questions/21342769/how-do-you-specify-all-the-namespaces-of-a-savon-client