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.

Eclipse 3.3
JAX-WS RI 2.1.5

Step 1: Download the JAX-WS RI jar(JAXWS2.1.5-20081030.jar) from

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.


  1. Anonymous4:45 AM

    Thanks buddy, you finally nailed it for me.

  2. Anonymous3:25 AM

    Thanks, it is really helpful one...