X

Geertjan's Blog

  • September 11, 2005

Deploying Web Service Clients to JBoss & Tomcat (Part 2)

Geertjan Wielenga
Product Manager
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):

jboss-install-dir\\server\\default\\deploy\\jbossweb-tomcat55.sar

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:

  1. Make sure the web service is up and running and that you have a URL that points to it.

  2. 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.

  3. 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.)

  4. 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.

  5. In the Files window, find the build.xml file and add this target:
    <target name="-pre-init">
    <!-- property libs.jaxrpc16.classpath is defined in
    $USERDIR/build.properties -->
    <property name="j2ee.platform.wscompile.classpath"
    value="${libs.jaxrpc16.classpath}"/>
    </target>

  6. In the Project Properties dialog box, change the target server from Sun Java System Application Server to JBoss or Tomcat.

  7. 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.

Join the discussion

Comments ( 2 )
  • Surya Monday, June 12, 2006
    Very helpful thanks Geertjan.
  • Mamata Wednesday, September 16, 2009

    Thanks a lot. It's working fine with tomcat.


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.