Creating WSDL (using JavaToWSDL 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 a WSDL from Java Source File and Click on next
  • Type the class name as in our case it is webservice1.TestService
  • Select the folder containing the TestService.class file
  • Now test if class is loadable by clicking on TEST CLASS LOADING ,if class doesnt loads that means wrong folder is added
  • Click on next button , next button will appear only if class loads successfully
  • Set the options as per your choice , as for us we will set as follow :
TargetNameSpace : webservice1
TargetNameSpace Prefix : misty
SchemaTargetNameSpace :webservice1/types
SchemaTargetNameSpace Prefix : types
ServiceName : TestService

  • Click on next button
  • Select the location where you want to place the output WSDL file , I recommend select src folder in the project workspace created by eclipse
  • Click on finish
A message should pop up acknowledging the success

Now after getting the WSDL file we will generate the client stubs next.

2 comments:

  1. When executing 'EclipseHomeDirectoryPath\eclipse.exe -clean -console -consoleLog -debug -vmargs -Xmx384M'

    The console indicated error messages, including the following.

    "Debug options: file:/c:/.options not found"

    and

    "!Message: one or more bundles are not resolved because the following root constraints are not resolved..."

    It listed several libraries in org.apache.axis2 are missing.

    But I had put the two plugins "org.apache.axis2.eclipse.service.plugin_1.6.1.jar" and "org.apache.axis2.eclipse.codegen.plugin_1.6.1.jar" under the plugins directory of Eclipse.


    Despite that, Eclipse was launched. But when I clicked on 'New->Other->' there was no 'Axis2 wizards' option available.

    Can you please help?

    ReplyDelete
  2. I googled and found that there are bugs with 1.6.1 version. So, I reversed everything to the 1.4 version as suggested by your blog. And it works!!! I now am able to

    But then again, I am having issues with this step, particularly the end "Select the location where you want to place the output WSDL file , I recommend select src folder in the project workspace created by eclipse"

    I see two radio buttons

    Button 1: Browse and add the WSDL to a project on the current Eclipse workspace
    Button 2: Browse and save the WSDL file on local file system
    Text box 1:Output location: (I chose the src folder in the project workspace)
    Text box 2: Output file name: (I left the name created by Eclipse unchanged, which is services.wsdl)

    The following error message occurs no matter which radio button I selected.

    An error occurred while completing process
    -java.lang.reflect.InvocationTargetException


    Can you please help? Thank you very much.

    ReplyDelete