Java JAX WS Client Example

This section shows you how to develop a Java client using the JAX WS stack. It uses the PAPI Web Service to retrieve a list of process instances visible to the connected user.

This example contains an analysis of the code of a PAPI Web Service client developed using JAX WS. The source code includes:

You can use this project as a basis to develop more complex examples. To do this you have to replace the class PapiWsJaxWsExample by the classes you develop, and change target run in the ant script so that it executes the new class.

A Java JAX-WS client contains two different type of classes:

JAX-WS portable artifacts

The web service client code uses these artifacts to operate with PAPI Web Service. JAX-WS provides a tool called Wsimport to generate these classes based on the WSDL PAPI Web Service. When you run Wsimport using PAPI Web Service WSDL as an input argument it generates the following classes:
  • Service Endpoint Interface
  • Service
  • Exception classes
  • Java classes mapped from the schema types referenced in the WSDL

This example uses Wsimport ant task to generate this artifacts. For information about Wsimport, see https://jax-ws.dev.java.net/nonav/2.1.2/docs/wsimport.html .

Client Java Classes

A PAPI Web Service client includes one or more Java classes that contain the code to invoke PAPI Web Service and operate with it. You have to code this classes yourself. The code in these classes uses JAX-WS portable artifacts to access the web service and to operate with it.

The client shown in this example contains only one class because it is a simple example. The code in this class performs the following actions:
  • Invokes the web service.
  • Authenticates using Username Token Profile and HTTP authentication.
  • Uses JAX-WS portable artifacts to obtain the list of process instances.

For a detailed analyses of this class, see JAX WS Client Main Class .

Download

You can download the set of java classes of this example from http://edocs.bea.com/albsi/docs60/resources/papi_ws/ALBPM-PapiWs-JaxWs-Example.zip . For information on how to run this example seeRunning Java JAX WS Client Example.