Develop a WSDL file

 

You need a WSDL file to use Web services. You can develop your own WSDL file or get one from a Web service provider through E-mail, downloading or through a URL. This documentation assumes you are creating your own.

To develop a WSDL file...

  1. Configure the Service Endpoint Interface class and referenced classes into your CLASSPATH.

    CLASSPATH=$CLASSPATH:colon-separated list of application JAR files and classes
    export CLASSPATH

  2. Run...

    Java2WSDL seiInterface

    A WSDL file named seiInterface.wsdl is created.

    • Move the WSDL file to the META-INF/wsdl subdirectory if you are using an enterprise JavaBean (EJB).

    • Move the WSDL file to the WEB-INF/wsdl subdirectory if you are using a Java bean.

  3. Edit the generated WSDL file and inspect the part names. The WSDL parts have names like arg_0_0. Modify the WSDL file to use the actual names of the Java parameters.

  4. (Optional) Use the Java2WSDL command tool to generate the correct part names of WSDL file.

    You can automatically generate and set the correct part names by using the Java2WSDL command tool. Generating and setting the part names is done by providing additional information to the Java2WSDL command tool in the form of a Java implementation class that implements the same methods as the Service Endpoint Interface and is compiled with debug information on (javac -g). Parameter names are stored in the .class file with the debug information. If your implementation class was compiled with debug on, you can use...

    Java2WSDL -implClass seiImpl seiInterface

    ...to generate a WSDL file having the proper part names.

A WSDL file that defines the Web service described by the Service Endpoint Interface.

 

Usage Scenario

This example uses a JAR file named AddressBook.jar containing a class named AddressBook.class file.

You must add the AddressBook.jar file to your CLASSPATH to create the WSDL file. The JAR file contains an EJB implementation class that was compiled with debugging information on. Run...

Java2WSDL -implClass addr.AddressBookBean addr.AddressBook

...to create a WSDL file named AddressBook.wsdl.

Develop Web services deployment descriptor templates from a WSDL file.

 

See Also

WSDL
Service Endpoint Interface
Develop a new Web service with an existing WSDL file using a Java bean
Develop a new Web service from an existing WSDL file using a stateless session enterprise bean
Develop a Web service using a stateless session enterprise bean
WSDL anatomy
Default Port Mapping Definitions collection
Default Port Type Mapping Properties settings
Web services client bindings
Web services implementation scope
Multipart WSDL best practices
Artifacts used to develop Web services based on Web Services for J2EE
Java2WSDL command