This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.
WSDL2Java
The "WSDL2Java" tool is used to generate Java code to provide or consume a Web service for a given WSDL. You can use this tool to develop Web services for contract first development. The tool provides many options to customize your code.
Follow the instructions below to use the "WSDL2Java" tool in WSO2 ESB.
1. Sign in. Enter your user name and password to log on to the ESB Management Console.
2. Click the "Tools" button to access the "Tools" menu.
3. From the "Tools" menu, select "WSDL2Java."
4. The "WSDL2Java" page appears. Fill in the fields as required.
Note
Each option is described on the "WSDL2Java" page.
5. Enter the URL of the WSDL in the the "uri" field.
Tip
Entering a value in this field is mandatory.
6. Click "Generate."
You can now call this stub object from your client Java code. Note that when you instantiate a stub object generated from WSDL2java without passing any parameters, the underling Axis2 runtime creates a configuration context for the new stub object. Therefore, when initializing multiple stub objects, many configuration context objects are created, which slows performance of the client. To avoid performance problems, create a Configuration context at the beginning of your client code and pass that same context to all stub objects. For example:
ConfigurationContext configurationContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem("repository", "axis2.xml");
CustomerOrderServiceStub stub = new CustomerOrderServiceStub(configurationContext, "http://localhost:8088/services/CustomerOrderService");