NetBeans 5.0 & Web service client on JBoss
Today we will create JSR-109 (container generated) web service client for the web service from my previous post. And we will use JBoss again
Code of the form in index.jsp, nothing more to say here:
Again an easy step - use a wizard for it. Fill in values for wsdl url (should be smth like http://localhost:8080/JBossWebservice/CalcService?WSDL), package name (I will use math.calculator.client), press Retrieve button and Finish the wizard. The client will be generated by IDE.
Now we will create the heart of our simple application - servlet which will call our web service and show us the result of that call. First, we will create some helper methods - for retrieving parameter from HttpServletRequest and for showing instance of ComplexNumber in human-readable way:
Following picture shows possible implementation of processRequest method without ws invocation code:
Now use "Web Service Client Resources -> Call Web Service Operation" action from editor's context menu on emtpy lines in our code. This action will add necessary helper methods to our servlet and also the ws operation invocation code. Only thing we have to do is to modify generated code in processRequest method. The result can look like this:
This is the most important part if we want to be run this project on JBoss. As in previous case (ws creation) we have to create server-side artifacts manually - here's target for project’s build.xml (if the name of your service is not CalcService replace it with yourServiceName):
And the last thing we have to do is to remove JAX-RPC library from the libraries which will be packaged with our application - we need this library only for building our project. So uncheck "package" checkbox in for JAX-RPC 1.6 library in Project properties -> Libraries.
Now we are ready to deploy and run our project. Let's see if it works (click on the picture for better view):
And here you can download sources for this project. Enjoy... 
Posted at 02:59PM Feb 03, 2006 by jungi in NetBeans | Comments[2]
Today's Page Hits: 32
Posted by Roumen on February 03, 2006 at 03:28 PM CET #
Posted by jungi on February 03, 2006 at 03:58 PM CET #