Running an unmanaged web services JAX-WS client
WebSphere Application Server provides a thin Java Platform, Standard Edition 6 (Java SE 6) web services client runtime implementation based on the Java API for XML-based Web Services (JAX-WS) 2.2 specification. The Thin Client for JAX-WS with WebSphere Application Server is a stand-alone Java SE 6 client environment that enables running unmanaged JAX-WS web services client applications in a non-WebSphere environment to invoke web services that are hosted by the application server.
Supported configurations: We can use the Thin Client for JAX-WS with WebSphere Application Server as a stand-alone client run time in a pure Java SE environment, or within an OSGi environment. The Thin Client for JAX-WS is not supported running within WebSphere Application Server or WebSphere Application Client environments. In this version of the application server, with the exception of the Administration Thin Client, other Thin Client run times provided with the application server can also reside in the CLASSPATH and coexist with the Thin Client for JAX-WS..
Before you set up a JAX-WS unmanaged client execution environment, obtain the Thin Client for JAX-WS JAR file. To obtain the Thin Client for JAX-WS, install WebSphere Application Server v8.5 or the Application Client for WebSphere Application Server v8.5. The Thin Client for JAX-WS JAR file, com.ibm.jaxws.thinclient_8.5.0.jar, is located in the app_server_root\runtimes directory.
Copy the Thin Client for JAX-WS, com.ibm.jaxws.thinclient_8.5.0.jar file and the endorsed_apis_8.5.0.jar files, to other machines to create a lightweight client environment that enables communications with the product. Copies of the Thin Client for JAX-WS are subject to the same terms and conditions of the license agreement for the WebSphere product where you obtained the Thin Client for JAX-WS. Refer to the license agreements for correct usage and other limitations.
The Thin Client for JAX-WS is supported in the following environments:
- IBM Software Development Kits (SDKs) Version 6.0
- non-IBM SDKs V6.0 with the following limitation:
- Xerces limitation on non-IBM SDKs
We must download Xerces-J Version 2.6.2, and add the file to the classpath when setting up the Thin Client for JAX-WS environment.
- WS-SecurityKerberos on non-IBM SDKs
WS-SecurityKerberos is not supported with the Sun JDK or other non-IBM SDKs. Applications running in a Thin Client for JAX-WS environment that make use of WS-Security message level protection and use Kerberos security tokens as described in the Web Services Security Kerberos Token Profile 1.1 specification, do not correctly work on non-IBM JDKs. This limitation exists because of a dependancy on the IBM JGSS provider that is only available within IBM SDKs.
- Equinox 3.6 OSGi runtime environments
Set up a Thin Client for JAX-WS environment by completing the following steps.
- Copy the Thin Client for JAX-WS JAR file, com.ibm.jaxws.thinclient_8.5.0.jar, to other machines to create a lightweight client environment.
- Use the Java Endorsed Standards Override Mechanism to override APIs that are available in the JDK on the system.
Because the Thin Client for JAX-WS with WebSphere Application Serverv8.5 requires APIs that are more current than what is available in JDKs to support JAX-WS 2.2 and JAXB 2.2 implementations, you must override the default JDK APIs in use by the system using the Java Endorsed Standards Override Mechanism.
Copy the app_server_root\runtimes\endorsed\endorsed_apis_8.5.0.jar file into the default directory, JAVA_JRE\lib\endorsed. Alternatively, we can use the java.endorsed.dirs property to specify a directory of the choice. If we choose to use an alternative directory, it is a best practice to only include the endorsed_apis JAR file.
- Configure the path. Add the Java bin directories to the path:
(zos)
set PATH=<your_JDK_bin_directory>;%PATH%
export PATH=<your_JDK_bin_directory>:$PATH
- Configure the classpath.
- Add the Thin Client for JAX-WS JAR file to the classpath definition.
Important: If the Thin Client is to use the Java Message Service (JMS), then all the JAR files required must be in the classpath for JMS and for the client so that entries exist for all the required files. Otherwise, required files will not be identified as installed and ready for use.
(zos)
set CLASSPATH=.;<your_jax-ws_thin_client_install_directory>\com.ibm.jaxws.thinclient_8.5.0.jar; <your_application_jars>;%CLASSPATH%(iseries)
export CLASSPATH=.:<your_jax-ws_thin_client_install_directory>/com.ibm.jaxws.thinclient_8.5.0.jar: <your_application_jars>;$CLASSPATH
- For a non-IBM SDK, obtain a Xerces xml-apis.jar file and xercesImpl.jar file from the Xerces website, and configure the classpath definition.
(zos)
set CLASSPATH=.;<your_Xerces_install_directory>\xml-apis.jar;<your_Xerces_install_directory> \xercesImpl.jar;%CLASSPATH%(iseries)
export CLASSPATH=.:<your_Xerces_install_directory>/xml-apis.jar:<your_Xerces_install_directory> \xercesImpl.jar:$CLASSPATH
- Optional: Implement policy sets for your client.
- Configure SSL for the client.
- Add the following system properties to the Java command:
-Dcom.ibm.SSL.ConfigURL=file:///home/sample/ssl.client.props
We can obtain ssl.client.props from the WAS installation and modify the file to suit the environment. We must, at a minimum, update the location of the com.ibm.ssl.keyStore and com.ibm.ssl.trustStore key files in ssl.client.props to the match location of the target environment. For example, use these SSL configuration settings when running the application with a Sun JRE:
com.ibm.ssl.protocol=SSL com.ibm.ssl.trustManager=SunX509 com.ibm.ssl.keyManager=SunX509 com.ibm.ssl.contextProvider=SunJSSE com.ibm.ssl.keyStoreType=JKS com.ibm.ssl.keyStoreProvider=SUN com.ibm.ssl.keyStore=/home/user1/etc/key.jks com.ibm.ssl.trustStoreType=JKS com.ibm.ssl.trustStoreProvider=SUN com.ibm.ssl.trustStore=/home/user1/etc/trust.jksThe key store file and trust store file must be created using the Java keytool utility before the application runs. The automatic key file generation is not supported with a non-IBM product JRE.
- Run the client application:
- Enter the following command if we have copied the endorsed_apis_8.5.0.jar file into the JAVA_JRE\lib\endorsed default directory; for example:
(zos)
%JAVA_HOME%\bin\java -Dcom.ibm.SSL.ConfigURL=file:\\\home\sample\ssl.client.props <your_client_application>
(iseries)
$JAVA_HOME/bin/java -Dcom.ibm.SSL.ConfigURL=file:///home/sample/ssl.client.props <your_client_application>
- Enter the following command if we have copied the endorsed_apis_8.5.0.jar file into a directory other than the default JAVA_JRE\lib\endorsed directory; for example:
(zos)
%JAVA_HOME%\bin\java -Djava.endorsed.dirs=<directory_that_includes_endorsed_apis_8.5.0.jar> -Dcom.ibm.SSL.ConfigURL=file:\\\home\sample\ssl.client.props <your_client_application>
(iseries)
$JAVA_HOME/bin/java -Djava.endorsed.dirs=<directory_that_includes_endorsed_apis_8.5.0.jar> -Dcom.ibm.SSL.ConfigURL=file:///home/sample/ssl.client.props <your_client_application>
Results
You have set up an unmanaged JAX-WS client runtime environment to invoke web services hosted on a WAS.
Related tasks
Task overview: Implement web services applications Implement static JAX-WS web services clients Example: Install a web services sample with the console Use JMS to connect to a WAS default messaging provider messaging engine
Related information:
Xerces website Java Endorsed Standards Override Mechanism Web Services Security Kerberos Token Profile 1.1