如果我有以下SOAP请求:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://test.org/" xmlns:hon="http://schemas.datacontract.org/2004/07/TEST.RVU.Entity">
<soapenv:Header/>
<soapenv:Body>
<tem:Authenticate>
<!--Optional:-->
<tem:authenticationDet>
<!--Optional:-->
<hon:AccountType>0</hon:AccountType>
<!--Optional:-->
<hon:Password>bacon</hon:Password>
<!--Optional:-->
<hon:UserName>smith</hon:UserName>
</tem:authenticationDet>
</tem:Authenticate>
</soapenv:Body>
</soapenv:Envelope>
如何使用包含tem:和hon:名称空间的Savon gem写下有效的soap请求?
由于
答案 0 :(得分:1)
您需要设置其他命名空间。
脚本可能如下所示:
#!ruby require "savon" Savon.configure do |c| c.pretty_print_xml = true c.env_namespace = :soapenv end client = Savon::Client.new do wsdl.namespace = "http://test.org" wsdl.endpoint = "http://www.your-real-endpoint.com" end resp = client.request :tem, 'Authenticate' do soap.namespaces["xmlns:hon"] = "http://schemas.datacontract.org/2004/08/TEST.RVU.Entity" soap.body = { "tem:authenticationDet" => { "hon:AccountType" => 0, "hon:Password" => "bacon", "hon:UserName" => "smith" } } end