JAX-WS client model


 

+

Search Tips   |   Advanced Search

 

The Java API for XML-Based Web Services (JAX-WS) Web service client model supports...

Dispatch client API Dynamic client programming model. Works at...

  • XML message level
  • JAX-WS level without any generated artifacts
Dynamic Proxy client API Static client programming model.
Invokes a Web service based on a service endpoint interface.

Both clients enable synchronous and asynchronous invocation of JAX-WS Web services.

 

Dispatch client

The Dispatch client API...

...supports invoking services at the XML message level. The Dispatch client can send data in...

When using...

javax.xml.ws.Service.Mode.MESSAGE

...the Dispatch client provides the entire SOAP envelope including...

<soap:Envelope>
<soap:Header>
<soap:Body>

When using...

javax.xml.ws.Service.Mode.PAYLOAD

...the Dispatch client is only responsible for providing the contents of...

...and JAX-WS includes the payload in a <soap:Envelope> element.

The Dispatch client API requires application clients to construct messages or payloads as XML which requires a detailed knowledge of the message payload.

The Dispatch client supports the following types of objects:

javax.xml.transform.Source Use XML APIs directly. Use Source objects with SOAP or HTTP bindings.
JAXB objects Use JAXB objects that are generated from an XML schema to create and manipulate XML with JAX-WS applications. JAXB objects can only be used with SOAP or HTTP bindings.
javax.xml.soap.SOAPMessage Work with SOAP messages. We can only use SOAPMessage objects with SOAP bindings.
javax.activation.DataSource Work with MIME messages. Use DataSource only with HTTP bindings.

For example, if the input parameter type is javax.xml.transform.Source, the call to the Dispatch client API is similar to the following code example:

 Dispatch<Source> dispatch =  create a Dispatch<Source> Source request = create a Source object Source response = dispatch.invoke(request);
The Dispatch parameter value determines the return type of the invoke() method. The Dispatch client is invoked in one of three ways:

 

Dynamic Proxy client

The static client model for JAX-WS is the called the Dynamic Proxy client and invokes a Web service based on a provided Service Endpoint Interface (SEI).

Dynamic Proxy client is similar to the stub client in the JAX-RPC in that both are based on the SEI generated from a WSDL file.

The Dynamic Proxy client is dynamically generated at run time using the Java 5 Dynamic Proxy. The JAX-RPC-based stub client is a non-portable Java file that is generated by tooling.

The Dynamic Proxy client does not require you to regenerate a stub prior to running the client on an appserver for a different vendor because the generated interface does not require the specific vendor information.

The Dynamic Proxy instances extend the class...

java.lang.reflect.Proxy

...and leverage the Dynamic Proxy function in the base JRE 6. The client application can then provide an interface used to create the proxy instance while the runtime is responsible for dynamically creating a Java object that represents the SEI.

The Dynamic Proxy client is invoked in one of three ways:





Related concepts

JAX-WS

 

Related tasks

Implementing JAX-WS Web services clients
Develop a JAX-WS client from a WSDL file
Invoking JAX-WS Web services asynchronously

 

Related

Web services specifications and APIs

 

Related information

JAX-WS API documentation
JAX-WS API User's Guide documentation