Using HTTP to transport web services requests for JAX-WS applications

You can develop an HTTP accessible Java™ API for XML-Based Web Services (JAX-WS) web service when you have an existing JavaBeans object to enable as a web service.

Before you begin

You must have an annotated JAX-WS JavaBeans object to enable as a web service. Optionally, you can run the wsgen command to create a Web Services Description Language (WSDL) file from your annotated JAX-WS JavaBeans component. You must specify the -wsdl option with the wsgen command to create the WSDL file.

For example: [Windows]
app_server_root/bin wsgen.bat  -classpath . -wsdl -servicename {http://mynamespace}MyService example.Stock.MyService 
[AIX][HP-UX][Linux][Solaris]
app_server_root/bin wsgen.sh  -classpath . -wsdl -servicename {http://mynamespace}MyService example.Stock.MyService 
[IBM i]
app_server_root/bin wsgen  -classpath . -wsdl -servicename {http://mynamespace}MyService example.Stock.MyService 
支援的配置 支援的配置: z/OS® 平台不支援 wsimportwsgenschemagenxjc 指令行工具。 這項功能是由隨執行於 z/OS 平台的 WebSphere® Application Server 提供的組合工具所提供。請閱讀 JAX-WS 應用程式的這些指令行工具以進一步瞭解這些工具。sptcfg

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

About this task

The application server 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 Java Platform, Enterprise Edition (Java EE) and the Java API for XML-Based Web Services (JAX-WS) specifications.

HTTP is the most commonly used transport for web services.

Procedure

  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, you can use a placeholder such as file:unspecified_location for the endpoint URL string.

    Note: If you deploy a JAX-WS JavaBeans 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 application server. The web application archive {WAR) file only needs the JavaBeans 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 service applications to appear dynamic to application users.

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

    You can 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

You have a JavaBeans object that uses HTTP to transport JAX-WS web services client requests.

What to do next

Publish the WSDL file.

指出主題類型的圖示 作業主題



時間戳記圖示 前次更新: July 9, 2016 11:18
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=twbs_httptransportjaxws
檔名:twbs_httptransportjaxws.html