我正在使用savon 版本 2(使用 Ruby on Rails)来调用 Web 服务,并且我需要向我的 Envelope 注入一些额外的命名空间。就像是:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:add="http://schemas.xmlsoap.org/ws/2003/03/addressing"
xmlns:newNamespace1="http://someURL.pt/Test1"
xmlns:newNamespace2="http://someURL.pt/Test2"
xmlns:newNamespace3="http://someURL.pt/Test3"
我目前的代码是:
client = Savon.client do
wsdl "https://someValidURL?wsdl"
namespace "http://someURL.pt/Test1"
namespace "http://someURL.pt/Test2"
namespace "http://someURL.pt/Test3"
end
response = client.call( ...the webservice call... )
...但在我的要求中,Savon 只放置了最后一个命名空间
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsns="http://someURL.pt/Test3"
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
我在Savon Git project上没有找到任何关于此的文档。
有没有人有解决这个问题的方法??
PS-我还检查了一种可能的解决方案是将所有 xml 请求(信封)设置为请求,但是......嗯......太像黑客了。
如果这是不可能的并且有其他好的宝石可以做到这一点,请告诉我=)