我是 SOAP 和 xml 的新手。我读了很多教程,但似乎没有什么是足够清楚的。
我有点困惑,到底如何发送 SOAP 请求?我尝试执行此操作的方法是将 SOAP 请求(如下所示)保存为:test Request.xml。
POST /MobileCashPayout.asmx HTTP/1.1
Host: 192.168.1.80
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<Payout xmlns="http://www.mycel.com/">
<Username>string</Username>
<Password>string</Password>
<referenceID>string</referenceID>
<sourceMsisdn>string</sourceMsisdn>
<destMsisdn>string</destMsisdn>
<Amount>decimal</Amount>
<MobilePin>string</MobilePin>
<cashInformation>string</cashInformation>
<merchantName>string</merchantName>
</Payout>
</soap12:Body>
</soap12:Envelope>
然后我用浏览器打开文件(testRequest.xml)以便发送它。
我得到的回报是一条错误消息,指出:
XML 解析错误:语法错误
位置: localhost/projects/test.xml
第 1 行,第 1 列:POST /MobileCashPayout.asmx HTTP/1.1
^
我发送方式错误吗?
请帮帮我好吗?
在浏览器中打开此文档不会发送请求。您有多种选择:
- 用任何熟悉的语言编写一个小脚本,脚本应连接到指定的服务器并发送带有消息中提到的正文的 POST 请求
- 使用一些现有的程序来为您做到这一点
如果您缺乏经验,我肯定会推荐第二种选择。我个人最喜欢的是SoapUI,参见here http://www.soapui.org.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)