what is soap web service used for code example

Example 1: what is soap request

It has strict rule on how to send request and response.

Soap Request use XML format to send and receive response

Only method allowed in SOAP is POST

The content type is always xml

Body is enclosed in envelop like structure for example :

Sample Post request to turn number into word

POST https://www.dataaccess.com/webservicesserver/NumberConversion.wso

Header : text/xml; charset=utf-8

Body :

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <NumberToWords xmlns="http://www.dataaccess.com/webservicesserver/">
      <ubiNum>123456789</ubiNum>
    </NumberToWords>
  </soap:Body>
</soap:Envelope>
Response

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
        <m:NumberToWordsResponse xmlns:m="http://www.dataaccess.com/webservicesserver/">
            <m:NumberToWordsResult>one hundred and twenty three million four hundred and fifty six thousand seven hundred and eighty nine </m:NumberToWordsResult>
        </m:NumberToWordsResponse>
    </soap:Body>
</soap:Envelope>

Example 2: when to use soap

Use the SOAP API to create, retrieve,
update or delete records, like accounts
, leads, and user-defined objects.
With more than 20 different calls, 
you can also use the SOAP API to manage
passwords, perform searches, etc.
by using the SOAP API in any language 
that supports web services.

Example 3: what is soap service

it stands for Simple Object Access Protocol.
Basically it's an xml based messaging protocol.
It helps in exchaging information among computers.

Tags:

Php Example