将复杂类型参数作为对象传递给Savon

时间:2017-10-10 06:15:33

标签: ruby-on-rails ruby wsdl soap-client savon

我想在Savon调用中将对象作为参数传递。我传递的哈希类型如下

require 'savon' 

class Test
def operation 
client = Savon.client(wsdl:'Web service wsdl link for eg http://google.com?wsdl')

//in this case p_request is the name of TestMessage type which i got while reading from wsdl 

data = { 'p_request' => { 'Request' => 'Test',
                      'Result' => 'empty'} }

response = client.call(:ping1, message: data)

但我收到了NULL响应。如何在Savon调用中传递Complex类型?

感谢任何帮助。

请查找WSDL

<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
<xs:import namespace="http://schemas.datacontract.org/2004/07/Xipaysandbox"/>
<xs:element name="Ping1">
<xs:complexType>
<xs:sequence>
<xs:element xmlns:q1="http://schemas.datacontract.org/2004/07/Xipaysandbox" minOccurs="0" name="p_request" nillable="true" type="q1:TestMessage"/>
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.datacontract.org/2004/07/Xipaysandbox" elementFormDefault="qualified" targetNamespace="http://schemas.datacontract.org/2004/07/Xipaysandbox">
<xs:import namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
<xs:complexType name="TestMessage">
<xs:sequence>
<xs:element minOccurs="0" name="Request" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="Result" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:element name="TestMessage" nillable="true" type="tns:TestMessage"/>
</xs:schema>
</wsdl:types>

0 个答案:

没有答案