Code Generator Wizard - eclipse Plug-in

This document explains the usage of this code generator plug-in for eclipse. In other words, this document will guide you through the operations of generating a WSDL file from a java class and/or generating a java class file from a WSDL file.

[Download Plugin Tool]

Content

Introduction

The Axis2 code generator comes built-in with an eclipse plug-in. This plug-in can be used to generate a WSDL file from a java class (Java2WSDL) and/or a java class file from a WSDL (WSDL2Java). First you need to install the plug-in. The instruction for installation are given below.

Installation

The easiest way to obtain the plug-in would be the binary distribution. The packages plug-in would be available from the tools section of the downloads page

If one needs to build the plugin from source it is not as trivial as running the Maven build. The reason is that the plug-in depends heavily on the Eclipse classes, which are only available in an Eclipse environment. The recommended procedure is to run the create-project.xml (in the "modules\tool" directory of the source distribution) build file which will create two folders (the other one for the Service Archiver tool) and copy the necessary files to relevant folders. Then Eclipse should be configured to open the contents in a PDE project. Please go through the Eclipse documentation to learn how to open projects in the PDE format.

Once you've obtained the plug-in just unzip the content of the plug-in archive to the eclipse plug-in directory (if it is the zipped-binary version) or copy the necessary folders to the eclipse plug-in directory and restart Eclipse.

Note - This plug-in works on Eclipse version 3.1 and upwards. The provided screen shots may slightly differ with what the user would actually see but the functionality has not been changed.

Operation - WSDL2Java

If the plug-in is properly installed you should see a new wizard under the "New" section.(use the File -> New -> Other or Ctrl + N )

Selecting the wizard and pressing the Next button will start the code generator wizard. Following is the first wizard page.

Page 1:

Selecting the 'Generate Java source code from WSDL file' option and clicking Next leads to the following page.

WSDL2Java Page 2 :

To move on to the next page the WSDL file location must be given. The Browse button can be used to easily browse for a file rather than typing the whole path.

WSDL2Java Page 3 :

Once the WSDL file is selected, the next page will take you to the page from where codegen options are to be selected. By far this is the most important page in this wizard. This page determines the characteristics of the code being generated.

Novices need not worry about these options since the most common options are defaulted, but advanced users will find it very easy to "turn the knobs" using these options.

Once the options are selected, only the final step of the code generation is left which is the selection of the output file location.

WSDL2Java Page 4 :

Here you can select the output file path by typing or browsing using the Browse button. You have the option of browsing only workspace projects by selecting the 'Browse Workspace projects only' 'checkbox.

When the output file location is selected, the Finish button will be enabled. Clicking the Finish button will generate the code and a message box will pop up acknowledging the success. Well Done! You've successfully completed Axis2 code generation.

Operation - Java2WSDL

Page 1:

For this operation you need to select the option which says 'Generate a WSDL from a Java source file'

Then click the Next button which will lead to the next page below.

Java2WSDL Page 2:

In this page one needs to select the class to be exposed and the relevant jar files /classes to be loaded as the classpath. After the libraries have been set, the 'Test Class Loading' button must be clicked in order to test whether the class is loadable. Unless the class loading is successful proceeding to the Next button will not be enabled.

Once the classloading is successful and Next button is clicked the page below will appear.

Java2WSDL Page 3:

This page allows the parameters to be modified by setting the options for the generator.

Java2WSDL Page 4:

Output file location can be browsed using the Browse button. Note that by selecting 'browse Workspace projects only' check box you can browse for workspace projects only. Once output file location and output WSDL file name is add you can click the Finish button to complete generation.

If a message box pops up acknowledging the success, then you've successfully completed the Java2WSDL code generation.

Appendix