Sujit Biswas

Thursday Feb 05, 2009

Soap1.2 in GlassfishESB

Now Soap1.2 is available as part of the glassfish ESB v2,  This is based on the specification for WSDL 1.1 Binding Extension for SOAP 1.2


Design time


1. WSDL Creation : The user experience remains the same while creating the wsdl i.e similar to soap1.1, note the binding type provided by the wsdl wizard



2. CASA Editor: The composite application now have a new port of type soap12 which corresponds to the soap1.2 binding , try the given example 



 


 3. WSIT and WS-Security Support


The experience is same as that soap1.1 port in casa editor , here is a sample snapshot , note one has to clone the wsdl soap1.2 port before configuring the same for ws-security, here is one sample



Runtime


Though one does not require to dig dipper in order to use Composite Application using soap1.2, it is always useful to keep in mind some of the difference which happens underneath the hood,


1. HttpBinding



  • The Content-Type for SOAP 1.2 has changed from text/xml used in SOAP 1.1 to application/soap+xml.

  • SOAPAction HTTP header is optional in SOAP 1.2, if  the wsdl soap12:operation  has the soapAction attribute, then it is mapped to "action" parameter, carried in the application/soap+xml Content-Type header field


 2. Soap Faults and Fault Codes



  • The SOAP 1.1 "Client" fault code is renamed "Sender" in SOAP 1.2.

  • The SOAP 1.1 "Server" fault code is renamed "Receiver" in SOAP 1.2.


  • Hierarchical fault code, note the fault code in soap1.1 was a qulified name , also soap1.1 allows fault code with dot notation , soap1.2 disallow the same and use more xml like structure





<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
              xmlns:m="http://www.example.org/timeouts"
              xmlns:xml="http://www.w3.org/XML/1998/namespace">
 <env:Body>
  <env:Fault>
   <env:Code>
     <env:Value>env:Sender</env:Value>
     <env:Subcode>
      <env:Value>m:MessageTimeout</env:Value>
     </env:Subcode>
   </env:Code>
   <env:Reason>
     <env:Text xml:lang="en">Sender Timeout</env:Text>
   </env:Reason>
   <env:Detail>
     <m:MaxTime>P5M</m:MaxTime>
   </env:Detail>   
  </env:Fault>
 </env:Body>
</env:Envelope>



  • Soap mustUnderstand faults 



When a SOAP node generates a fault with a Value of Code set to "env:MustUnderstand", it SHOULD provide NotUnderstood SOAP header

<?xml version="1.0" ?>
<env:Envelope xmlns:env='http://www.w3.org/2003/05/soap-envelope'
              xmlns:xml='http://www.w3.org/XML/1998/namespace'>
 <env:Header>
  <env:NotUnderstood qname='abc:Extension1'
                   xmlns:abc='http://example.org/2001/06/ext' />
  <env:NotUnderstood qname='def:Extension2'
                   xmlns:def='http://example.com/stuff' />
 </env:Header>
 <env:Body>
  <env:Fault>
   <env:Code><env:Value>env:MustUnderstand</env:Value></env:Code>
   <env:Reason>
     <env:Text xml:lang='en'>One or more mandatory
       SOAP header blocks not understood
     </env:Text>
   </env:Reason>
  </env:Fault>
 </env:Body>
</env:Envelope>




  • VersionMismatch faults: When a SOAP node generates a fault with a Value of Code set to "env:VersionMismatch", it SHOULD provide an Upgrade SOAP header block in the generated fault message. The Upgrade SOAP header block, describes the supported SOAP envelopes that the SOAP node supports


3. Infoset and Namespace


SOAP 1.2 is based on XML Infoset where as SOAP 1.1 is based on XML 1.0, SOAP 1.2 use the namespace http://www.w3.org/2003/05/soap-envelope  which is different from SOAP 1.1


4. Soap Processing Model, Actors and Roles


The actor attribute in soap 1.1 is renamed to role in soap12, A SOA P role is used to indicate the SOAP node to which a particular SOAP header block is targeted


















 next  "http://www.w3.org/2003/05/soap-envelope/role/next  Each SOAP intermediary and the ultimate SOAP receiver MUST act in this role
 none  http://www.w3.org/2003/05/soap-envelope/role/none  SOAP nodes MUST NOT act in this role
 ultimateReceiver  http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver  The ultimate receiver MUST act in this role


 5. Soap Encoding


      Encoding is simplified compared to soap1.1, for details see specification,




  • The href attribute in SOAP 1.1 (of type xs:anyURI) is called enc:ref in SOAP 1.2 and is of type IDREF



  • The syntax of serilization of arrays has been changed compared to soap1.1



  • more details about the soap encoding is available here



 Import Links



 

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed

Calendar

Feeds

Search

Links

Navigation

Referrers