Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do you send a SOAP request?

Tags:

http

soap

xml

I am new to SOAP and xml. I read a number of tutorials but nothing seems to be clear enough.

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>

I then open the file (testRequest.xml) with a browser in order for it to be sent..

what I get in return is an error message stating: XML Parsing Error: syntax error Location: localhost/projects/test.xml Line Number 1, Column 1:POST /MobileCashPayout.asmx HTTP/1.1 ^

Am I sending it the wrong way? Please help me out?

like image 710
SirBT Avatar asked Jul 12 '12 07:07

SirBT


People also ask

How do I make a SOAP API request?

To make SOAP requests to the SOAP API endpoint, use the "Content-Type: application/soap+xml" request header, which tells the server that the request body contains a SOAP envelope. The server informs the client that it has returned a SOAP envelope with a "Content-Type: application/soap+xml" response header.

How does a SOAP request work?

A SOAP client formulates a request for a service. This involves creating a conforming XML document, either explicitly or using Oracle SOAP client API. A SOAP client sends the XML document to a SOAP server. This SOAP request is posted using HTTP or HTTPS to a SOAP Request Handler running as a servlet on a Web server.


1 Answers

Opening this document in browser wouldn't send a request. You have several options:

  • write a little script in any familiar language, script should connect to specified server and send a POST request with a body as mentioned in your message
  • use some of existing programs to do that for you

If you're inexperienced I would definitely recommend second option. My personal favourite is SoapUI, see here.

like image 119
Miljen Mikic Avatar answered Sep 20 '22 18:09

Miljen Mikic