【发布时间】:2015-12-04 00:47:01
【问题描述】:
谁能解释我如何使用 savon 来提出这个肥皂请求:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ent="some_adress">
<soapenv:Header>
<ent:providerID>?</ent:providerID>
</soapenv:Header>
<soapenv:Body>
<ent:operationRequest>
<ent:operation>
<!--You may enter the following 2 items in any order-->
<ent:id>operation_id</ent:id>
<ent:params>
<!--1 or more repetitions:-->
<ent:entry>
<ent:key>param1_name</ent:key>
<ent:value>param1_valuee</ent:value>
</ent:entry>
<ent:entry>
<ent:key>param2_name</ent:key>
<ent:value>param2_value</ent:value>
</ent:entry>
</ent:params>
</ent:operation>
</ent:operationRequest>
</soapenv:Body>
</soapenv:Envelope>
我在soapUI 中收到的这个soap 请求。
我试过这个(不是发出请求,而是看看 savon 将如何生成soap请求):
test_message = {:param_1_name => 'param 1 value', :param_2_name => 'param 2 value'}
ops = wsdl_client.operation(:request_operation)
ops.build(message: test_message).to_s
而且结果和soapUi请求的结果很不一样:
<?xml version="1.0" encoding="UTF-8" ?>
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns1="some_adress" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ins0="some_adress">
<env:Header>
<ent:providerID>999</ent:providerID>
</env:Header>
<env:Body>
<ins0:operationRequest>
<ns1:param1Name>param 1 value</ns1:param1Name>
<ns1:param2Name>param 2 value</ns1:param2Name>
</ins0:operationRequest>
</env:Body>
</env:Envelope>
我不知道如何将此“条目”添加到 savon 请求中。
谢谢你!
【问题讨论】:
-
如果有帮助请查看此帖子stackoverflow.com/questions/22606875/…
标签: ruby-on-rails soap savon