Savon: How to change header from being <env:Header> to <soap:Header> or something different

别来无恙 提交于 2019-12-07 04:44:08

问题


In Savon, is there a way to change

<env:Header>

to be

<soap:Header>

or anything different?

I've tried in the request block putting an additional header tag like this:

soap.header['soap:Header']

But that won't work.

I've browsed Savon Docs and haven't found anywhere to change that tag, only by manually building the XML.


回答1:


EDITED for Savon 1.0.0

The value can be set in the configure block where you can also set logging and other parameters. Simply put

Savon.configure do |c|
  c.env_namespace = :soap
end

into your code.




回答2:


For newer versions of Savon:

Savon.client(env_namespace: :soapenv) 


来源:https://stackoverflow.com/questions/6538757/savon-how-to-change-header-from-being-envheader-to-soapheader-or-somethin

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