What is SOAP?

What is SOAP?

SOAP is a protocol designation for shuffle structured information in the application 

of Web Services in computer networks. It depends on Extensible Markup Language 

(XML) for its message format, and normally depend on other Application Layer 

protocols, most notably Hypertext Transfer Protocol (HTTP) and Simple Mail

 Transfer Protocol (SMTP), for information agreement and transmission.

Consuming SOAP web services from Android

Though SOAP based web-services are limited in these days, but there are lots of 

old companies whose web-services are still SOAP-based. If anyone wants to consume

 those services from Android, it is very important to know the procedure of consuming 

SOAP-based webservice.

Now, we will learn how to consume SOAP web services from Android. Before starting 

code, we have to collect some information:

  • SOAP_ACTION

  • METHOD_NAME

  • NAMESPACE

  • URL

  • Parameter List

  • Request XML/ SOAP_BODY/ 

    SOAP_MESSAGE (for Nested Parameters and Multiple Namespaces)

Now, the question is how can we get these information? if your client or service 

provider give you all the information, you won’t need anything and know more 

about Android Training in Chandigarh.

Android Training in Chadigarh

 

How it works?

URL: It is the url of WSDL file.
NAMESPACE: The targetNamespace in WSDL.
METHOD_NAME: It is the method name in web service. We can have several 
methods.
SOAP_ACTION: NAMESPACE + METHOD_NAME.
You can obtain above details by reading WSDL file of web service.
The soap web service that we are going used in this example have only one 
method that takes a number as parameter and find its square.

How to call soap web service?

  • First create request object of SoapObject class.
  • Now add information to request object that you want to send to web service.
 This is done using PropertyInfo class.
  • Create soap envelope using SoapSerializationEnvelope class.
  • Assign request object to envelope using setOutputSoapObject().
  • Create object of HttpTransportSE() class. Using this object call the
 soap web service.
  • We can get return from web service by using getResponse() method 
of SoapSerializationEnvelope class. The response is gathered into SoapPrimitive  
reference variable.

Learn Android Training in Chandigarh provided by CBitss Technologies.

0 comments:

Post a Comment