In Deploying Web Service Clients to JBoss & Tomcat (Part 1)
, I wrote about some tweaks that are necessary in order to use web services & clients with JBoss or Tomcat. Well, it all turns out to be a little less arduous than I thought at the time. For a start, NetBeans IDE 5.0 bundles the JAX-RPC libraries that you need, so you don't need to copy them from a Sun Java System Application Server installation.
However, an odd thing I've discovered is that both the Sun Java System Application Server and JBoss use 8080 as their HTTP connector port. This is a bit unfortunate when you're using both -- so what you need to do is (a) manually set the JBoss HTTP connector port in this file to something other than 8080 (I use 8090):
But, (b) you also need to change 8080 to 8090 -- or whatever you chose in (a) -- when registering JBoss with the IDE. And you can't change this once you've set it -- you've got to deregister and then reregister JBoss if you want a second chance to set the HTTP connector port. So, note that if you think you're changing the JBoss port number during registration of JBoss with NetBeans, you're wrong.
So, let's go through the process of consuming a web service via a client deployed to JBoss or Tomcat:
- Make sure the web service is up and running and that you have a URL that points to it.
- Create a web application (Ctrl-Shift-N). You must select the Sun Java System Application Server as your target server, otherwise you won't be able to create the web service client in the next step.
- Create the web service client. (Right-click the project node and choose New > Web Service Client.) You must use the IDE-generated client stubs, otherwise the client will not be able to deploy to JBoss or Tomcat, because neither JBoss nor Tomcat comply fully/correctly with JSR-109 when creating stubs. (In the case of JBoss, there's some issue that relates to misinterpreting document/literal web services.)
- Right-click the project node, go to Libraries, click Add Library and select JAX-RPC1.6 from the Add Library drop-down. You must do this, otherwise you will not have the JAX-RPC libraries needed to build and deploy the client to JBoss or Tomcat.
- In the Files window, find the build.xml file and add this target:
<!-- property libs.jaxrpc16.classpath is defined in
- In the Project Properties dialog box, change the target server from Sun Java System Application Server to JBoss or Tomcat.
- Run the application.
The only unfortunate thing about the procedure above is that you need the Sun Java System Application Server, otherwise you can't create the web service client. However, apart from that clunky step, everything seems relatively doable to me.
The next thing to look at is how to deploy a web service to JBoss and Tomcat. I've tried but so far not succeeded.