Implementing web services applications from existing WSDL files with JAX-WS

When starting with an existing Web Services Description Language (WSDL) file, you can use a top-down approach to developing web services based on the Java™ API for XML-Based Web Services (JAX-WS) programming model.

Before you begin

最佳作法 最佳作法: IBM® WebSphere® Application Server 支援 Java API for XML 型 Web 服務 (JAX-WS) 程式設計模型和 Java API for XML 型 RPC (JAX-RPC) 程式設計模型。JAX-WS 是延伸 JAX-RPC 程式設計模型所提供之基礎的下一代 Web 服務程式設計模型。 當使用策略性 JAX-WS 程式設計模型時,透過支援標準型註釋模型,簡化了 Web 服務和用戶端的開發工作。 雖然仍支援 JAX-RPC 程式設計模型和應用程式,但請利用易於實作的 JAX-WS 程式設計模型來開發新的 Web 服務應用程式和用戶端。best-practices

Locate the WSDL file that defines the web service that you want to implement. You can develop a WSDL file or obtain one from an existing web service through email, downloading or a Uniform Resource Locator (URL).

About this task

To develop web services based on the JAX-WS programming model, you can use a bottom-up development approach starting from existing JavaBeans or enterprise beans or you can use a top-down development approach starting with an existing Web Services Description Language (WSDL) file. This task describes the steps when using the top-down development approach.

Considerations when using JavaBeans
  • JavaBeans exposed as JAX-WS web services are supported only over an HTTP transport.
  • JavaBeans may use Contexts and Dependency Injection (CDI). Note that constructor injection is not supported.
Considerations when using enterprise beans
  • The enterprise bean must be a stateless or singleton session bean.
  • Enterprise beans that are exposed as JAX-WS web services must be packaged in EJB 3.0 or higher modules.
  • JAX-WS web service applications containing enterprise beans must be deployed with the endptEnabler command.
  • JAX-WS web services using enterprise beans are supported over an HTTP or Java Message Service (JMS) transport.
  • Enterprise beans may use CDI. Note that constructor injection is not supported.

Procedure

  1. Set up a development environment for web services. You do not have to set up a development environment if you are using Rational® Application Developer.
  2. Develop Java artifacts for JAX-WS applications using the wsimport command-line tool. The wsimport tool processes a WSDL file and generates portable Java artifacts that are used to create a web service.
  3. (optional) Enable MTOM for JAX-WS web services. You can use SOAP Message Transmission Optimization Mechanism (MTOM) to optimize the transmission of binary attachments such as images or files along with web services requests.
  4. (optional) Enforce adherence to WSDL bindings in JAX-WS web services. You can use the RespectBindingFeature to control whether a JAX-WS implementation is required to respect the contents of a wsdl:binding that is associated with an endpoint.
  5. (optional) Develop and configure a webservices.xml deployment descriptor for JAX-WS applications. You can optionally use the webservices.xml deployment descriptor to augment or override application metadata specified in annotations within your JAX-WS web services.
  6. Complete the implementation of your web service application.
  7. (Optional) Customize URL patterns in the web.xml file. When JavaBeans are exposed as JAX-WS endpoints, you can optionally customize the URL patterns within the web.xml deployment descriptor contained in the web application archive (WAR) file.
  8. Assemble the artifacts for your web service.
  9. Deploy the EAR file into the application server. You can now deploy the EAR file that has been configured and enabled for web services onto the application server.
  10. Test the web service to make sure that the service works with the application server.

Results

You have created a JAX-WS web service by starting with an existing WSDL file.


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



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