To create a JAX-WS client, the following steps can be completed:
1. Create the JAX-WS web service.
2. Create the JAX-WS client.
3. Deploy client code to an Expeditor client.
==Create the JAX-WS web service
==
Using Rational Application Developer (RAD), create a web service that will simply respond with date information to the caller.
Create a class file with the following contents.
package com.ibm.rcp.support.ws.remote;
import java.util.Calendar;
public class RemoteSystem {
public String getSystemTime(){
return Calendar.getInstance().getTime().toString();
}
}
To generate a web service on the above bean, simply:
1. Right mouse click the class file in the package navigator.
2. Select Web Services -> Create Web Service.
3. Select the "IBM WebSphere JAX-WS" web service runtime.
4. Select the corresponding WebSphere Application server runtime.
5. Complete the wizard using default values.
6. Export the EAR project as an EAR.
7. Install the enterprise application EAR in the WebSphere Application Server.
You should now be able to validate that a Web Service can be found at the following URL:
http://<your_was_server>:<port>/com.ibm.rcp.support.ws.remote/services/RemoteSystem
==Create the JAX-WS client
==
Again in RAD, create the client code by completing:
1. Create a Client Services Project
2. Locate the WSDL file within the Web Service project; usually in WEB-INF/wsdl.
3. Copy the WSDL file into the Client Services project.
4. Update the WSDL files, "wsdlsoap:address location" to reference your WebSphere server.
5. Right mouse click the WSDL file and select Generate Client.
6. Select the JAX-WS web service runtime.
7. Select the WebSphere Application Server v7.0 server.
8. Complete the wizard using default values.
Note that even though you selected the WebSphere runtime, deploying to Lotus Expeditor is possible.
==Deploy client code to an Expeditor client
==
Given we have a simple skeleton, you will likely need to do additional development. When importing the project into Eclipse, you will notice an error in the project.
This is due to a RAD variable. Simply remove the WAS_V7JAXWS_WEBSERVICES_THINCLIENT variable.
If you intend on using the variable and corresponding library, ensure that the JAR is either deployed to Expeditor as a plugin or contained within the JAX-WS Client Services plugin.
Next update the Activator class to test the plugin.
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
RemoteSystemProxy proxy = new RemoteSystemProxy();
System.out.println(proxy.getSystemTime());
}
Either deploy to an Expeditor Client or launch an Expeditor Client from the Eclipse IDE. Invoke the Web Service client by issueing the command
start <bundle_symbolic_name> on the OSGI console. For example, start com.ibm.rcp.support.ws.remote.client.jaxws. The Activator will instantiate and call the web service using its start() method. You may alternatively invoke the web service within your own code.
(See attached file: jax-ws_source_projects.zip)