+

Search Tips   |   Advanced Search

Use HTTP to transport Web services requests for JAX-WS applications


We can develop an HTTP accessible JAX-WS Web service when we have an existing Java Beansobject to enable as a Web service.

You must have an annotated JAX-WS Java Beans object to enable as a Web service. Optionally, we can run the wsgen command to create a Web Service Description Language (WSDL) file from the annotated JAX-WS Java Beans component. You must specify the -wsdl option with the wsgen command to create the WSDL file. For example:

(Windows)

APP_ROOT/bin wsgen.bat  -classpath . -wsdl -servicename {http://mynamespace}MyService example.Stock.MyService 

[AIX] [HP-UX] [Linux] [Solaris]

APP_ROOT/bin wsgen.sh  -classpath . -wsdl -servicename {http://mynamespace}MyService example.Stock.MyService 

Supported configurations: The wsimport, wsgen, schemagen and xjc command-line tools are not supported on the z/OS platform. This functionality is provided by the assembly tools provided with WAS running on the z/OS platform. Read about these command-line tools for JAX-WS applications to learn more about these tools.

To learn about developing a JAX-WS Web service using annotations, read about developing Java artifacts for JAX-WS applications using Java Beans.

The appserver supports the use of HTTP to transport Web services client requests. With HTTP, the Web services clients and servers can communicate through SOAP messages. SOAP is the underlying communication protocol used in Web services that support the Web Services for Java EE and the JAX-WS specifications.

HTTP is the most commonly used transport for Web services.

 

  1. 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, that is accessible on the HTTP transport. An HTTP binding is a wsdl:binding element that contains a soap: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 soap:address element with a location attribute that specifies an HTTP endpoint URL string.

    When you develop the Web service, we can use a placeholder such as file:unspecified_location for the endpoint URL string.

    If we deploy a JAX-WS Java Beans component as a Web service without a WSDL file, a WSDL file is automatically generated for the component.

  2. For JAX-WS Web services applications, no HTTP transport configuration is needed. The HTTP transport settings are generated dynamically by the appserver. The Web archive {WAR) file only needs the Java Beans object along with the optional WSDL file properly installed.
  3. Deploy the Web services application.
  4. Configure security for the HTTP transport.

    To configure a secure HTTP transport, attach the SSLTransport policy to the application. To specify the basic authentication transport token, use the administration console to set the user ID and the password attributes in the HTTPTransport binding.

  5. (Optional) Configure HTTP session management.

    HTTP session management enables JAX-WS Web Services applications to appear dynamic to application users.

  6. (Optional) Set the asynchronous response listener for JAX-WS clients.

    Use the asynchronous response listener within the Thin Client for JAX-WS and application client environments to receive responses for requests that are invoked asynchronously.

  7. 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 enterprise archive (EAR) file. The published WSDL file can be used by clients, that need to invoke the Web service.

 

Results

we have a Java Beans object that uses HTTP to transport JAX-WS Web services client requests.

 

Next steps

Publish the WSDL file.


Web Services transactions, high availability, firewalls and intermediary nodes

 

Related tasks


Use HTTP to transport Web services
Use the asynchronous response servlet
Use the asynchronous response listener
Use HTTP session management support for JAX-WS applications
Set the HTTP transport policy
Set the SSL transport policy
Develop a JAX-WS service endpoint implementation with annotations
Generating Java artifacts for JAX-WS applications

 

Related


wsgen command for JAX-WS applications