LibraryToggle FramesPrintFeedback

To generate consumer code use the wsdl2java tool. Enter the following command at a command-line prompt:

wsdl2java -ant -client -d outputDir hello_world.wsdl

Where outputDir is the location of a directory where the generated files are placed and hello_world.wsdl is a file containing the contract shown in Example 3.1. The -ant option generates an ant build.xml file, for use with the ant build utility. The -client option generates starting point code for the consumer's main() method.

For a complete list of the arguments available for the wsdl2java tool see wsdl2java in Web Service Tool Reference.

The preceding command generates the following Java packages:

  • org.apache.hello_world_soap_http — This package is generated from the http://apache.org/hello_world_soap_http target namespace. All of the WSDL entities defined in this namespace (for example, the Greeter port type and the SOAPService service) map to Java classes this Java package.

  • org.apache.hello_world_soap_http.types — This package is generated from the http://apache.org/hello_world_soap_http/types target namespace. All of the XML types defined in this namespace (that is, everything defined in the wsdl:types element of the HelloWorld contract) map to Java classes in this Java package.

The stub files generated by the wsdl2java tool fall into the following categories:

Comments powered by Disqus
loading table of contents...