Use HTTP to transport Web services requests
Overview
This task leads you into developing an HTTP accessible Web service when you already have a JavaBean object to enable as a Web service.
Run the Java2WSDL command to create a Web Services Description Language (WSDL) file. When you run the Java2WSDL command, use the -bindingsTypes option, along with http, to set the HTTP transport bindings. For example:
java2wsdl -bindingTypes http,jms -implClass my.pkg.MyEJBClass my.pkg.MySEIWAS supports the use of HTTP to transport Web services client requests. With HTTP, your Web services clients and servers can communicate through SOAP messages. SOAP is the underlying communication protocol that is used in Web services that support the Web Services for J2EE and the JAX-RPC specifications.
HTTP is the most commonly used transport for Web services.
To develop an HTTP-accessible Web service from an existing an existing JavaBean object:
Procedure
- Add an HTTP binding and a SOAP address to the WSDL file.
The WSDL file of a Web service must include an HTTP binding and a SOAP address, which specifies an HTTP endpoint URL string, to be accessible on the HTTP transport. An HTTP binding is a wsdl:binding element that contains a wsdlsoap:binding element with a transport attribute that ends in soap/http.
In addition to the HTTP binding, a wsdl:port element that references the HTTP binding must be included in the wsdl:service element within the WSDL file. The wsdl:port element contains a wsdlsoap:address element with a location attribute that specifies an HTTP endpoint URL string.
When you develop the Web service, a placeholder such as file:unspecified_location can be used for the endpoint URL string.
- Add the HTTP endpoints to your enterprise archive (EAR) file using the endptEnabler command, if your application includes enterprise beans.
By default, the endptEnabler command adds only HTTP endpoints.
- Deploy the Web services application.
- Configure security for the HTTP connection.
For a secure HTTP connection, add the basicAuth assembly property to the ibm-webservicesclient-bnd.xmi deployment descriptor file. Set the user ID and the password attributes.
- Configure the endpoint URL information for HTTP bindings.
The WSDL publisher uses this partial URL string to produce the actual HTTP URL for each port component defined in the EAR file. The published WSDL file can be used by clients, that need to invoke the Web service.
Results
You have a JavaBean object that uses HTTP to transport Web services client requests.
What to do next
Publish the WSDL file.