what is a soap api 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 :



  
    
      123456789
    
  

Response



    
        
            one hundred and twenty three million four hundred and fifty six thousand seven hundred and eighty nine 
        
    

Example 2: when to use soap api

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: advantages of soap

SOAP is both platform and language independent.
SOAP separates the encoding and communications
protocol from the runtime environment.
Web service can retrieve or receive a SOAP
user data from a remote service, and the
source’s platform information is completely
independent of each other.
Everything can generate XML, from Perl
scripts through C++ code to J2EE app servers.
It uses XML to send and receive messages.
It uses standard internet HTTP protocol.
SOAP runs over HTTP; it eliminates
firewall problems. When protocol HTTP
is used as the protocol binding, an
RPC call will be automatically assigned 
to an HTTP request, and the RPC response
will be assigned to an HTTP reply.
Compared to RMI, CORBA and DCOM, SOAP
is very easy to use.
SOAP acts as a protocol to move information 
in a distributed and decentralized environment.
SOAP is independent of the transport protocol
and can be used to coordinate different protocols.

Tags:

Misc Example