Skip to main content

JAX-WS 2.0 Provider-based endpoints explained!

Posted by arungupta on March 20, 2006 at 8:24 AM PST

Jitu implemented the support
for Provider-based endpoints in JAX-WS RI.
Without undermining the wonderful effort of JAX-WS esteemed spec leads, here is
an attempt to capture a whiteboard discussion on Provider-based endpoints
possible combinations that Jitu
and I had last Friday afternoon.

JAX-WS 2.0 introduces javax.xml.ws.Provider
interface that is an alternative to a Java service endpoint interface (SEI)
based endpoint. It is used if the services need to work at the XML message
level.

A Provider-based endpoint can receive data in javax.xml.transform.Source,
javax.activation.DataSource
or javax.xml.soap.SOAPMessage
formats. It can work in either payload or message mode.
JAX-WS specification has a conformance requirement (Provider support required)
that defines the combinations of the Provider type, the mode and SOAP/HTTP or
XML/HTTP binding. Additionally, the message on the service endpoint may be
received as SOAP message (does not matter 1.1
or 1.2) or a mime
multipart
message. The table below summarizes the requirement with all the
possible combinations.

  XML/HTTP SOAP/HTTP

Provider<Source>

Payload Primary part or content as Source SOAP Body from the primary part or SOAP Body
as Source
Message Primary part or content as Source SOAP Envelope from the primary part or SOAP
Envelope as Source

Provider<DataSource>

Payload Not Valid [1] Not Valid [1]
Message DataSource as an object Not Valid [2]

Provider<SOAPMessage>

Payload Not Valid [3] Not Valid [3]
Message Not Valid [4] SOAPMessage as an object

Provider<Source> may receive a mime multipart message or an XML
message. If it is a mime multipart message, then the primary part for XML/HTTP
and SOAP Envelope for SOAP/HTTP is extracted and converted to the Source for
payload mode. The primary part, in the case of mime multipart message, must
contain XML data for XML/HTTP binding. If it is an XML message then the content
for XML/HTTP (irrespective of mode) is converted to the Source. The XML message
is converted to SOAP message and SOAP Body or Envelope for SOAP/HTTP (depending
upon the mode) is converted to the Source.

[1] Provider<DataSource> is used for sending
attachments and thus payload mode is not valid.

[2] Provider<DataSource> in SOAP/HTTP is not valid
since attachments in SOAP are sent using Provider<SOAPMessage>.

[3] Provider<SOAPMessage> in payload mode is not
valid because the entire SOAPMessage is received, not just the payload which
corresponds to the body of the SOAPMessage.

[4] Provider<SOAPMessage> in message mode using
XML/HTTP binding is not valid since the client may have sent an XML message that
may not be SOAP.

Provider<Source>-based endpoints using XML/HTTP binding allows you to
develop and deploy RESTful Web services with JAX-WS 2.0. Read Marc
Hadley
's blog
for more details.

I'll provide a similar explanation on Dispatch-based
clients, used to invoke RESTful Web service, in a subsequent blog.

JAX-WS is available in Glassfish.

Technorati:
Rest
Web services

Related Topics >>