问题描述
我是SOAP和xml的新手.我读了一些教程,但似乎还不够清楚.
I am new to SOAP and xml. I read a number of tutorials but nothing seems to be clear enough.
我有点困惑,一个人如何发送SOAP请求?我尝试执行此操作的方法是将SOAP请求(如下所示)保存为:testRequest.xml.
I am abit confused, Just how does one send an SOAP request? The way I have tried to do this is by saving my SOAP request (as seen below) as: testRequest.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),以便发送该文件.
I then open the file (testRequest.xml) with a browser in order for it to be sent..
我得到的是一条错误消息,指出:XML解析错误:语法错误位置:localhost/projects/test.xml第1行,第1列:POST/MobileCashPayout.asmx HTTP/1.1^
what I get in return is an error message stating:XML Parsing Error: syntax errorLocation: localhost/projects/test.xmlLine Number 1, Column 1:POST /MobileCashPayout.asmx HTTP/1.1^
我发送的方式有误吗?请帮帮我吗?
Am I sending it the wrong way?Please help me out?
推荐答案
在浏览器中打开此文档不会发送请求.您有几种选择:
Opening this document in browser wouldn't send a request. You have several options:
- 用任何一种熟悉的语言编写一个小脚本,该脚本应连接到指定的服务器,并按照邮件中的提示发送带有正文的POST请求
- 使用一些现有程序为您完成
如果您没有经验,我绝对会建议您选择第二种方法.我个人最喜欢的是SoapUI,请参见此处.
If you're inexperienced I would definitely recommend second option. My personal favourite is SoapUI, see here.
这篇关于您如何发送SOAP请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!