Develop a WSDL file for JAX-RPC applications
We can develop a WSDL file to describe the characteristics of the JAX-RPC web services application including where the service resides and how to invoke the service using an XML format.
Depending on the development path, develop a service endpoint interface from a JavaBeans implementation or develop a service endpoint interface from an enterprise bean implementation.
You need a WSDL file to use web services. We can develop our own WSDL file or get one from a web services provider through email, downloading, or through a Uniform Resource Locator (URL). This documentation assumes you are creating our own.
Develop a WSDL file by following the actions listed:
- (iseries) Run the Start Qshell (STRQSH) command to start the Qshell.
- (iseries) Update the CLASSPATH environment variable to include the location of the service endpoint interface class and other referenced classes, for example:
export -s CLASSPATH=/myapp/myclass.class:/myapp/myjar.jar
- (dist)(zos) Configure the service endpoint interface class and referenced classes into the CLASSPATH variable.
- On Windows systems, set CLASSPATH="%CLASSPATH%;list the application JAR files and classes".
- On UNIX and Linux systems, export CLASSPATH="$CLASSPATH:list the application JAR files and classes".
- Run the Java2WSDL seiInterface command. A WSDL file named seiInterface.wsdl is created.
(zos) Supported configurations: The Java2WSDL command-line tool is not supported on the z/OS platform. This functionality is provided by the assembly tools provided with the z/OS version of the product. Read about the Java2WSDL command-line tool for Java API for XML-based Remote Procedure Call (JAX-RPC) applications to learn more about this tool.
- Move the WSDL file to the META-INF/wsdl subdirectory if you are using EJB.
- Move the WSDL file to the WEB-INF/wsdl subdirectory if you are using JavaBeans.
- 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.
- Optional. Use the Java2WSDL command tool to generate the correct part names of WSDL file. We can automatically generate and set the correct part names 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 turned on. Parameter names are stored in the .class file with the debug information. If the implementation class is compiled with debug on, we can use the Java2WSDL -implClass seiImpl seiInterface command to generate a WSDL file with the proper part names.
Results
A WSDL file that defines the web services described by the service endpoint interface.
Example
This example uses the JAR file name AddressBook.jar containing a class named AddressBook.class class file.
We must add the AddressBook.jar file to the CLASSPATH to create the WSDL file. The JAR file contains an EJB implementation class that is compiled with debugging information turned on. Run the Java2WSDL -implClass addr.AddressBookBean addr.AddressBook command to create the file, AddressBook.wsdl.
What to do next
Depending on the development path, develop web services deployment descriptor templates for JavaBeans or develop web services deployment descriptor templates for an enterprise beans implementation.
Subtopics
- Java2WSDL command for JAX-RPC applications
The Java2WSDL command-line tool maps Java classes to a WSDL file for JAX-RPC applications.
- (dist) Mapping between Java language, WSDL and XML for JAX-RPC applications
Data for Java API for XML-based Remote Procedure Call (JAX-RPC) applications flows as extensible Markup Language (XML). JAX-RPC applications use mappings to describe the data conversion between the Java language and extensible Markup Language (XML) technologies, including XML Schema, WSDL and SOAP that are supported by the application server.
- Develop JAX-RPC web services deployment descriptor templates for a JavaBeans implementation
Deployment descriptors are standard text files, formatted using XML and packaged in a web services application. Deployment descriptors are required to deploy JAX-RPC web services developed using Web Services for Java EE technology.
- Develop JAX-RPC web services deployment descriptor templates for an enterprise bean implementation
We can develop deployment descriptor templates for an EJB implementation that is enabled for JAX-RPC web services.
Related concepts
WSDL Development and assembly tools
Related tasks
Implement web services applications with JAX-RPC Implement web services applications from existing WSDL files with JAX-RPC Develop a service endpoint interface from JavaBeans for JAX-RPC applications Develop a service endpoint interface from enterprise beans for JAX-RPC applications Develop JAX-RPC web services deployment descriptor templates for a JavaBeans implementation Develop JAX-RPC web services deployment descriptor templates for an enterprise bean implementation Making deployed web services applications available to clients
Artifacts used to develop web services