Home > Documentation > Developer's guide > Tutorials > Web services > Developing Clients for a JAX-WS Web Service |
This tutorial will take you through the steps required in developing, deploying and testing a Web Service Client in Apache Geronimo for a web services which are already deployed on the server
This tutorial will take you through the steps involved in creating a Web based Client and a POJO Client for a JAX-WS web service. Here we will only be needing the WSDL file of the web service deployed for creating the client.
For new users, Web Services can be created in two ways:
This tutorial will help you in creating a Top Down Web Service from WSDL document which is already deployed on server.
To run this tutorial, as a minimum you will be required to have installed the following prerequisite software.
Details on installing eclipse are provided in the Development environment section.
This tutorial assumes that you have completed the Developing a JAX-WS POJO Web Service tutorial. Here we will try to develop the client for the web service deployed in the above mentioned tutorial.
This tutorial will take you through the following steps:
The following steps will help you in creating a Web based Client for a JAX-WS Web Service which is already deployed on the server.
We need to create Service Endpoint Interface based on the WSDL document to use it in out JSP's. Luckily in Geronimo this can be automated using the jaxws-tools utility provided by Geronimo.
Please take care that jaxws-tools.bat utility in server's bin directory may not work in old versions of Apache Geronimo.
Try using the latest version of Geronimo i.e v2.1.1 .
Let us walk through the steps that we just completed
This concludes the development section of our web based client.
Note that we accessed the webservice in the jsp by creating a service, and then retrieving the Converter port from the WSDL document.
Here we will have a look on how to create a plain old java client for consuming the web service.
This completes the development section of our POJO client
Now our Java project might show many errors and even if we resolve the errors the application may not run properly. This is due to the missing jar files required to access and understand SOAP messages sent by web service.
The version numbers may differ slightly. It wont matter much.
axis2-adb-1.3.jar - <GERONIMO_INSTALL_DIR>/repository/org/apache/axis2/axis2-adb/1.3/axis2-adb-1.3.jar
axis2-java2wsdl-1.3.jar - <GERONIMO_INSTALL_DIR>\repository\org\apache\axis2\axis2-java2wsdl\1.3\axis2-java2wsdl-1.3.jar
axis2-jaxws-1.3.jar - <GERONIMO_INSTALL_DIR>\repository\org\apache\axis2\axis2-jaxws\1.3\axis2-jaxws-1.3.jar
axis2-kernel-1.3.jar - <GERONIMO_INSTALL_DIR>\repository\org\apache\axis2\axis2-kernel\1.3\axis2-kernel-1.3.jar
axis2-metadata-1.3.jar - <GERONIMO_INSTALL_DIR>\repository\org\apache\axis2\axis2-metadata\1.3\axis2-metadata-1.3.jar
axis2-saaj-1.3.jar - <GERONIMO_INSTALL_DIR>\repository\org\apache\axis2\axis2-saaj\1.3\axis2-saaj-1.3.jar
axiom-api-1.2.5.jar - <GERONIMO_INSTALL_DIR>\repository\org\apache\ws\commons\axiom\axiom-api\1.2.5\axiom-api-1.2.5.jar
axiom-dom-1.2.5.jar - <GERONIMO_INSTALL_DIR>\repository\org\apache\ws\commons\axiom\axiom-dom\1.2.5\axiom-dom-1.2.5.jar
axiom-impl-1.2.5.jar - <GERONIMO_INSTALL_DIR>\repository\org\apache\ws\commons\axiom\axiom-impl\1.2.5\axiom-impl-1.2.5.jar
XmlSchema-1.3.1.jar - <GERONIMO_INSTALL_DIR>\repository\org\apache\ws\commons\schema\XmlSchema\1.3.1\XmlSchema-1.3.1.jar
neethi-2.0.jar - <GERONIMO_INSTALL_DIR>\repository\org\apache\neethi\neethi\2.0\neethi-2.0.jar
wsdl4j-1.6.1.jar - <GERONIMO_INSTALL_DIR>\repository\wsdl4j\wsdl4j\1.6.1\wsdl4j-1.6.1.jar
xml-resolver-1.1.jar - <GERONIMO_INSTALL_DIR>\repository\xml-resolver\xml-resolver\1.1\xml-resolver-1.1.jar
xml-beans-2.3.0.jar - <GERONIMO_INSTALL_DIR>\repository\org\apache\xmlbeans\xmlbeans\2.3.0\xmlbeans-2.3.0.jar
commons-codec-1.3.jar - <GERONIMO_INSTALL_DIR>\repository\commons-codec\commons-codec\1.3\commons-codec-1.3.jar
commons-httpclient-3.0.1.jar - <GERONIMO_INSTALL_DIR>\repository\commons-httpclient\commons-httpclient\3.0.1\commons-httpclient-3.0.1.jar
wstx-asl-3.2.1.jar - <GERONIMO_INSTALL_DIR>\repository\woodstox\wstx-asl\3.2.1\wstx-asl-3.2.1.jar
Also add Server Runtime Library to class path which reduces the effort for adding some more jars.
Note that these jars are used when JAX-WS Engine is configured as Axis2. If JAX-WS engine is configured as CXF the jars may differ slightly.
This completes the adding external JARs to the project
If you are running Java 6 you don't need to worry about the external JARs as they are all inbuilt into JRE 6. But you should copy all the files generated by wsimport command into appropriate packages as Runtime Modeller in Java 6 is slightly different.
This completes the development and deployment of clients for consuming a Web Service. Even though this tutorial demonstrated for one particular Web Service, the method can be extended for any deployed web service.
Bookmark this on Delicious Digg this | Privacy Policy - Copyright © 2003-2011, The Apache Software Foundation, Licensed under ASL 2.0. |