Pages

Sunday, December 07, 2008

Tutorial to use Eclipse with JAX-WS for contract-first Webservice

I assume that the wsdl is already present and this tutorial is to show, how to use eclipse to generate the java code.

Configuration:
Eclipse 3.3
JAX-WS RI 2.1.5
JDK 6

Step 1: Download the JAX-WS RI jar(JAXWS2.1.5-20081030.jar) from https://jax-ws.dev.java.net/2.1.5/

Step 2: Run the command java -jar JAXWS2.1.5-20081030.jar, Accept the license and allow it to be installed. I will call this $JAXWS_HOME

Step 3: Open eclipse, and Run->External Tools->Open External Tools Dialogue..

Step 4: Give name as GenerateJavaFromWSDL, Location as $JAXWS_HOME\bin\wsimport.bat, Working Directory(path to directory containing wsdl) as ${project_loc}/WEB-INF/wsdl where ${project_loc} [Eclipse variable already defined in eclipse, no need to create this ]is the project location in eclipse, arguments as "myWSDL.wsdl -keep -d ${project_loc}/WEB-INF/src" [without quotes] where myWSDL.wsdl is the wsdl to generate java code, keep is to keep the generated java files and d is the output directory. You can also provide p as argument to specify the package for the java files being generated.

Step 5: Click the Run button. The java files are generated.

2 comments:

  1. Anonymous4:45 AM

    Thanks buddy, you finally nailed it for me.

    ReplyDelete
  2. Anonymous3:25 AM

    Thanks, it is really helpful one...

    ReplyDelete