Generate a Stub/Proxy Client from a WSDL File

Generate a Stub/Proxy Client from a WSDL File

To generate a stub/proxy client from a WSDL file, you need to download Axis from the Apache website This tip will work for jdk1.4.x or above.

Suppose you have a WSDL file named Login.wsdl and you’re working on the directory (in Windows, c:wstest). Just follow these steps:

  1. Set the classpath:
    C:wstest>set classpath=%CLASSPATH%;axis.jar;axis-ant.jar;commons-discovery-0.2.jar;commons-logging-1.0.4.jar;jaxrpc.jar;log4j-1.2.8.jar;saaj.jar;wsdl4j-1.5.1.jar;c:wstest
  2. Set the Java path to java org.apache.axis.wsdl.WSDL2Java Login.wsdl.
  3. Execute the following command to generate the necessary classes:

    See below for the sample files.

  4. Instantiate the XXXLocator class and invoke getXXXSoap() to get a XXXSoap instance.
  5. Use the XXXSoap instance to call the webservice methods.
  6. Instantiate the LoginLocator class and invoke getLoginSoap() to get a LoginSoap instance.
  7. Using the LoginSoap instance to call the webservice methods:
     LoginLocator locator = new LoginLocator(); LoginSoap soap = locator.getLoginSoap(); soap.xxxMethod();

See also  Why ChatGPT Is So Important Today

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist