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:
- A set of ant scripts to generate the stubs from the WSDL, compile the code and
run it
- A lib directory containing the external libraries needed to code an compile the JAX-WS client
You can use this project as a basis to develop more complex examples. To do this replace the
class PapiWsJaxWsExample by the classes you develop, and change the 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
- Client Java 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 these 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
.