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 given below to use the WSDL2Java tool in the ESB profile.

  1. Log in to the Management Console.
  2. Click Tools to open the Tools menu.
  3. From the Tools menu, select WSDL2Java.
  4. The WSDL2Java page appears. Fill in the fields as required.
  5. Enter the URL of the WSDL in the URL field. 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 underlying 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 the 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");