my code was just:
client = Savon.client(wsdl: ENV['SOAP_WSDL'],
basic_auth: [ENV['SOAP_USERNAME'],
ENV['SOAP_PASSWORD']])
@soap = client.call(:check_contactor, message: { 'INN' => '1234' })
Вопрос
I have a SOAP client, and want to make a query to it with '74326' value. Please help me to build it.
<xs:element name="CheckContactor">
<xs:complexType>
<xs:sequence>
<xs:element name="INN" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
I am trying to achieve this in the following way:
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' } })
Please give me any example!
Решение 2
my code was just:
client = Savon.client(wsdl: ENV['SOAP_WSDL'],
basic_auth: [ENV['SOAP_USERNAME'],
ENV['SOAP_PASSWORD']])
@soap = client.call(:check_contactor, message: { 'INN' => '1234' })
Другие советы
Are you receiving any errors? More information would be good to give you a good answer. Example:
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>
Ruby:
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"
}
}
})
Reference: https://coderwall.com/p/erwfda