我需要点击SOAP服务,然而,服务器不接受我的请求,但由于请求中的页眉和页脚如下而引发错误。
根据日志,请求/响应如下所示:
SOAP **request**: http://www.url.co.au/wserv/wslms.php
SOAPAction: "insertlmsdata", Content-Type: text/xml;charset=UTF-8, Content-Length: 938
<?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:tns="urn:lmsdataautomation" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Body>
<tns:insertlmsdata>
<lmsinfo>
<userCred>
<clientCode>code</clientCode>
<username>name</username>
<password>ee#@!</password>
</userCred>
<lead>
<requestno>3</requestno>
<firstname>Meckinsey</firstname>
<lastname>Meth</lastname>
<email>meckinsey.meth@er.com</email>
<mobileno>4233333333</mobileno>
<keyword>Romali</keyword>
<requestMessage>looking for Romali</requestMessage>
<responseMessage>Romadd</responseMessage>
<operator>you</operator>
<circle>Romaon</circle>
<requestDate>20-04-2017</requestDate>
<shortCode>2222</shortCode>
<category>DOM</category>
<city>Sydney</city>
<destination>Perth</destination>
</lead>
</lmsinfo>
</tns:insertlmsdata>
</env:Body>
</env:Envelope>
HTTPI POST request to www.egggo.co.au (excon)
SOAP **response** (status 200)
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:lmsdataautomation" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:insertlmsdataResponse>
<output xsi:type="xsd:string"><output>Either parsed xml is not valid or contains special chars like & "'</output></output>
</ns1:insertlmsdataResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
我已经彻底查看了Savon文档,无法找到任何相关内容。我可以将Savon配置为不添加页眉,页脚,信封和身体吗?
基本上忽略以下数据:
SOAP 请求:http://www.url.co.au/wserv/wslms.php SOAPAction:&#34; insertlmsdata&#34;,Content-Type:text / xml; charset = UTF-8,Content-Length:938
否则,SOAP服务器拒绝该请求。请帮助,TIA
添加请求正文:
client = Savon.client(wsdl: url, log: true, logger: Rails.logger, log_level: :debug, pretty_print_xml: true, encoding: 'UTF-8')
response = client.call(:insertlmsdata, message: {'lmsinfo'=> {'userCred'=> {'clientCode' => 'code', 'username' => 'dom', 'password' => '#pass' }, 'lead' => {'requestno' => 3, 'firstname'=>'Methyl', 'lastname'=> 'Orange', 'email' => 'methyl.orange@egg.com', 'mobileno' => '55555555', 'keyword' => 'atlanta', 'requestMessage' => 'looking for atlant', 'responseMessage' => 'dd', 'operator' => 'you', 'circle' => 'sydney', 'requestDate' => '04-20-2017', 'shortCode' => 2222, 'category'=> 'DOM', 'city' => 'Sydney', 'destination' => 'Atlanta' } } })