Pages

Thursday, April 10, 2008

Developing JAX-RPC based Web Services using Java WSDP


A bit of technical stuff today. Yesterday I tried out Sun's WSDP (Web Services Development Pack) to create client and server side artifacts using WSDL, and deploying it on a web server.
Earlier, I used to develop web services using BEA's Weblogic workshop, which had loads of automated tools to create the service en
dpoint interfaces, looking at the WSDL, and generate client proxies to invoke the web services. But, as I am currently studying about JAX-RPC, I was interested to try out the JAX-RPC implementation developed by Sun.
I downloaded the available Java WSDP pack from the Sun site. I used the tools present in the pack to compile and deploy a web service: wscompile and wsdeploy. It started by creation of a sample WSDL file. Once created, I created an ant build script which made use of wscompile to generate server side artifcats. This als
o involved the creation of a configuration file for the wscompile task to understand. Once the service endpoint interfaces were generated, I implemented the iterface with a dummy web service, and compiled the whole application.

There are 2 phases of development of a w
eb service using the pack - first a raw WAR file is created, having the server side classes, a web deployment descriptor (web.xml), and a JAX-RPC deployment descriptor (jaxrpc-ri.xml). The raw WAR file has the following structure:
  • WEB-INF/classes
  • WEB-INF/jaxrpc-ri.xml
  • WEB-INF/web.xml
  • WEB-INF/model.xml.gz
The model.xml.gz file is generated while using wscompile.
Based on the jaxrpc-ri.xml (has to be manually created), use the wsdeploy task to create a "cooked" WAR which is ready to be deployed on a web server. Again, in the original Ant build script, this task was added.

Once the service is deployed, now comes the creation of client stubs/proxies to invoke the webservice. Using the same wscompile to
ol (but this time specifying that the client side artifacts need to be generated), the client stubs are created, and thats about it.

The configuration files provides all the f
eatures to include handlers, namespace mapping etc which is generally needed in the web service.

With this development pack, only JSE (Java Service Endpoints) are created (no EJB endpoints).

For further details, and instructions (including sample applications), refer to Understanding your JAX-RPC SI Environment.

The sample application can be downloaded here.

No comments:

Post a Comment