我有一个SOAP客户端,并希望使用' 74326'来查询它。值。请帮我构建它。
<xs:element name="CheckContactor">
<xs:complexType>
<xs:sequence>
<xs:element name="INN" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
我试图通过以下方式实现这一目标:
client = Savon.client(wsdl: ENV['SOAP_WSDL'],
basic_auth: [ENV['SOAP_USERNAME'],
ENV['SOAP_PASSWORD']])
@soap = client.call(:check_contactor,
message: { complex_type: { inn: '1234' } })
请举个例子!
答案 0 :(得分:1)
您收到任何错误吗?更多信息可以很好地给你一个很好的答案。例如:
WSDL:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mag="http://magiccompany.com/supermagic">
<soapenv:Header/>
<soapenv:Body>
<mag:example>
<someStuff>123</someStuff>
<someAuthStuff xmlns:n2="http://magiccompany.com/specialstuff"
xsi:type="n2:SpecialLogin">
<username>abc</username>
<password>test123</password>
</someAuthStuff>
</mag:example>
</soapenv:Body>
</soapenv:Envelope>
红宝石:
require 'savon'
client = Savon.client(wsdl: 'wsdl/magic.wsdl', ssl_verify_mode: :none, ssl_version: :TLSv1)
client.call(:example, message: {
someStuff: 123,
someAuthStuff: {
username: "abc",
password: "test123"
},
:attributes! => {
someAuthStuff: {
"xsi:type" => "n2:SpecialLogin",
"xmlns:n2" => "http://magiccompany.com/specialstuff"
}
}
})
答案 1 :(得分:0)
我的代码只是:
client = Savon.client(wsdl: ENV['SOAP_WSDL'],
basic_auth: [ENV['SOAP_USERNAME'],
ENV['SOAP_PASSWORD']])
@soap = client.call(:check_contactor, message: { 'INN' => '1234' })