Creating Java Client Stubs (using WSDLtoJava tool)

Important Note :
To use this tool we need minimum JDK version 6 and we need to open Eclipse with clean parameter (as explained below)

  • Open Eclipse from command line using syntax given below
EclipseHomeDirectoryPath\eclipse.exe -clean -console -consoleLog -debug -vmargs -Xmx384M
Example:
C:\Eclipse3311\eclipse\eclipse.exe -clean -console -consoleLog -debug -vmargs -Xmx384M

  • Now Select the New->Other->Axis2 wizards->Axis2 CodeGenerator
  • Select Generate Java Source Code from WSDL File and Click on next
  • Browse the WSDL file we created just now and click on next
  • Click on next again
  • Select the output file folder, in our case select the webservice1 folder in project folder
  • Tick the Add the Axis2 codegen jars to the codegen resulted project option
  • Tick the Add Axis2 libraries to the codegen result project
  • Give the path of the Axis2 binary home directory , this is to get all the libraries(jars) used by stub into the lib directory in project folder
  • Click on finish
  • A message should pop up acknowledging the success
  • Now If you have given the path for your Axis home correctly then you should get the lib folder in your project folder of eclipse and it will contain all the required jars in it.
  • You need to add the these jars into your project properties. I hope you know how to add libraries to your project in Eclipse , if not please see web for it , this is not a tutorial on Eclipse.
  • If you correctly included the libraries then the red lines in the generated stubs files in the project should go :) and they should be error free.

2 comments:

  1. Hi Chirag ,

    I tried following your step but i still facing this issue:

    'An error occurred while completing process -
    java.lang.InterruptedException :java.lang.RuntimeException :
    java.lang.reflect.InvocationTargetException '.

    ReplyDelete
  2. try this thing :
    Go to your workspace folder which Eclipse creates , You will see a metadata folder there , go to metadata>plugins>servicearchiver>, and delete the file present in it.[if you are opening Eclipse for the first time then no need for this step]
    Open Eclipse from command line using syntax given below
    EclipseHomeDirectoryPath\eclipse.exe -clean -console -consoleLog -debug -vmargs -Xmx384M
    Example:
    C:\Eclipse3311\eclipse\eclipse.exe -clean -console -consoleLog -debug -vmargs -Xmx384M


    actually the tool is too buggy

    ReplyDelete