How do you specify all the namespaces of a savon client

允我心安 提交于 2019-12-11 11:52:45

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!