ruby-on-rails – Rails – Savon设置了多个名称空间

我正在使用 savon version 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请求(信封)设置为请求但是……嗯…太像黑客了.

如果这是不可能的,还有其他好的宝石可以做到这一点,请告诉我=)

解决方法

我发现不可能(现在)在Savon的第2版上设置多个名称空间.

现在我在Savon版本1上迁移我的应用程序,它工作=)

begin
    client = Savon::Client.new do
        wsdl.document = "https://someURL?wsdl"
    end

  @response = client.request :service do
       soap.namespaces["xmlns:test1"]  = "http:/someURLtest1"
       soap.namespaces["xmlns:test2"]  = "http:/someURLtest2" 

       soap.body = { #... the message....
          :"test1:something" => {},:"test2:something1" => {}
                   }
   end


  rescue Savon::Error => error
     log error.to_s
  end

更多信息herehere.

这个问题将通过以下代码在Savon 2的下一个版本中得到解决

namespaces(
   "xmlns:first" => "http://someURL.pt/Test1","xmlns:two"   => "http://someURL.pt/Testweewqwqeewq"
)

相关文章

validates:conclusion,:presence=>true,:inclusion=>{...
一、redis集群搭建redis3.0以前,提供了Sentinel工具来监控各...
分享一下我老师大神的人工智能教程。零基础!通俗易懂!风趣...
上一篇博文 ruby传参之引用类型 里边定义了一个方法名 mo...
一编程与编程语言 什么是编程语言? 能够被计算机所识别的表...
Ruby类和对象Ruby是一种完美的面向对象编程语言。面向对象编...