Web Services SOAP

Simple Object Access Protocol (SOAP) means various things to different people:
 • It's a wire protocol.
 • It's an RPC mechanism.
 • It's an interoperability standard.
 • It's a document exchange protocol.
 • It's a universal business-to-business communications language.
 • SimpleObject Access Protocol – http://www.w3c.org/TR/SOAP/
 • A lightweight protocol for exchange of information in a decentralized, distributed environment.
 • Two different styles to use: – to encapsulate RPC calls using the extensibility and flexibility
    of XML. – to deliver a whole document without any method calls encapsulated

XML messaging using SOAP

#web Services, #SOAP, #XML, #messaging
SOAP specification

• The SOAP specification describes four major components: Formatting conventions for encapsulating data. Ex: SOAP envelope, header, body etc., Routing directions in the form of an envelope, a transport or protocol binding, Ex: SOAP sender , receiver etc., Encoding rules An RPC mechanism
• The envelope defines a convention for describing the contents of a message, which in turn has implications on how it gets processed.
• A protocol binding provides a generic mechanism for sending a SOAP envelope via a lower level protocol such as HTTP.
• Encoding rules provide a convention for mapping various application data types into an XML tag-based representation.
• Finally, the RPC mechanism provides a way to represent remote procedure calls and their return values.

SOAP Message Structure
#web Services, #SOAP, #XML, #messaging, #message structure

Block structure of a SOAP envelope


SOAP Request Envelope:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:q0="http://emp" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
SOAP Response Envelope: 
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <getNameResponse xmlns="http://emp">
   <getNameReturn>Welcome Vinod</getNameReturn> 
SOAP Structure

• A SOAP message is contained in an envelop.
• The envelop element in turn contain (in order)
– An optional header with one or more child entries.
– A body element that can contain one or more child entries.
       These child entries may contain arbitrary XML data.
Adding Header
  <jaws:MessageHeader xmlns:jaws="urn:training-samples">
SOAP Headers
• Headers are really just extension points where you can include elements from other namespaces.
  – i.e., headers can contain arbitrary XML.
• Header entries may optionally have a “mustUnderstand” attribute.
  – mustUnderstand=1 means the message recipient must process the header element.
  – If mustUnderstand=0 or is missing, the header element is optional.

Body entries are really just placeholders for arbitrary XML from some other namespace.
• The body contains the XML message that you are transmitting.
• The message format is not specified by SOAP.
   – The <Body></Body> tag contains actual XML message.
   – The recipient decides what to do with the message.
  <getNameResponse xmlns="http://emp">
  <getNameReturn>Welcome Vinod</getNameReturn> 
SOAP RPC Example
A simple example
– Calls with a string   public String hello(String name)
– Returns a greeting            “Hi!” + name

No comments:

Post a Comment

Please provide your input, it will honer for me...