JAX-WS 2.0 Early Access 2 - SOAP 1.2
Last Modified: 06/16/2005
Introduction
The default binding supported by JAXWS 2.0 is SOAP 1.1 over HTTP. With
this release we have added SOAP 1.2
binding over HTTP support into JAXWS 2.0. This document
describes how SOAP 1.2 binding can be applied to an endpoint and how it
can be used on the client side in the case of proxy port. To enable SOAP 1.2 support
in the Dispatch
client please refer to the Dispatch
documents.
SOAP 1.2 Endpoint
To enable SOAP 1.2 binding on an endpoint. You would need to set
binding attribute value in sun-jaxws.xml to SOAP
1.2 HTTP binding value as specified by
javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING which is:
"http://www.w3.org/2003/05/soap/bindings/HTTP/".
Here is the sun-jaxws.xml from fromjava-soap1.2 sample:
<?xml version="1.0" encoding="UTF-8"?>
<endpoints xmlns='http://java.sun.com/xml/ns/jax-ws/ri/runtime' version='2.0'>
<endpoint
name='fromjava-soap12'
implementation='fromjava_soap12.server.AddNumbersImpl'
binding="http://www.w3.org/2003/05/soap/bindings/HTTP/"
urlpattern='/addnumbers'/>
</endpoints>
JAXWS 2.0 generates WSDL on the fly when requested by a client. If this
binding attribute is present and is equal to SOAP 1.2 HTTP binding WSDL
with SOAP 1.2 binding is generated. Based on this binding descriptor
jaxws runtime configures itself to handle SOAP 1.2 messages.
The commandline wsgen and the equivalent ant
task can be used to generate SOAP 1.1 (default) or SOAP 1.2 WSDL. The
binding information should be passed using -wsdl:protocol switch.
Client
On the client there is nothing special that has to be done. jaxws
runtime looks into the WSDL to determine the binding being used and
configures itself accordingly. wsimport command
line tool or wsimport ant task can be used to import the WSDL and to
generated the client side artifacts.
Limitations
- No SOAP 1.2 Header processing such as soap12env:MustUnderstand
processing and related soap12env:MustUnderstand fault. Also SOAP12
Header role attribute processing.
- SOAP12 Fault
- As of now JAXWS throws SOAP 1.2 specific fault but the
ProtocolException instance representing SOAP 1.2 Fault is jaxws
implementation specific - com.sun.xml.ws.encoding.soap.message.SOAP12FaultException.
The JAXWS 2.0 specification is defining SOAPFaultException that can be
used for both SOAP 1.1 and SOAP 1.2 faults. As soon as we migrate to
the latest JAXWS 2.0 API the implementation specific SOAP 1.2 fault
exception class will be replaced by the one defined by API.
Samples
There are 2 samples bundled with this release
- fromwsdl-soap12 - shows SOAP 1.2 endpoint developed starting from
wsdl
- fromjava-soap12 - shows SOAP 1.2 endpoint developed starting from
Java
A SOAP 1.2 message generated by JAXWS:
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 178
SOAPAction: ""
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<addNumbers xmlns="http://duke.org">
<arg0>10</arg0>
<arg1>20</arg1>
</addNumbers >
</soapenv:Body>
</soapenv:Envelope>
A SOAP 1.2 Fault message generated by JAXWS:
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 476
SOAPAction: ""
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<soapenv:Fault>
<soapenv:Code>
<soapenv:Value>soapenv:Sender</soapenv:Value>
</soapenv:Code>
<soapenv:Reason>
<soapenv:Text xml:lang="en">Negative number cant be added!</soapenv:Text>
</soapenv:Reason>
<soapenv:Detail>
<AddNumbersFault xmlns="http://duke.org">
<faultInfo>Numbers: -10, 20</faultInfo>
<message>Negative number cant be added!</message>
</AddNumbersFault >
</soapenv:Detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>