Implement web services applications from existing WSDL files with JAX-WS
When starting with an existing Web Services Description Language (WSDL) file, we can use a top-down approach to developing web services based on the JAX-WS programming model.
Best practice: IBM WAS supports JAX-WS and JAX-RPC. JAX-WS extends JAX-RPC. JAX-WS supports annotations. best-practices
Locate the WSDL file that defines the web service to implement. We can develop a WSDL file or obtain one from an existing web service through email, downloading or a Uniform Resource Locator (URL).
To develop web services based on the JAX-WS programming model, we can use a bottom-up development approach starting from existing JavaBeans or enterprise beans or we can use a top-down development approach starting with an existing 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.
- Set up a development environment for web services.
- Develop Java artifacts for JAX-WS applications using the wsimport command-line tool.
- (Optional) Enable MTOM for JAX-WS web services.
- (Optional) Enforce adherence to WSDL bindings in JAX-WS web services.
- (Optional) Develop and configure a webservices.xml deployment descriptor for JAX-WS applications.
- Complete the implementation of the web service application.
- (Optional) Customize URL patterns in web.xml.
- Assemble the artifacts for the web service.
- Deploy the EAR file into the application server.
- Test the web service to verify the service works with the application server.
Results
You have created a JAX-WS web service by starting with an existing WSDL file.
Subtopics
- Set up a development environment for web services.
- Develop Java artifacts for JAX-WS applications using the wsimport command-line tool.
- (Optional) Enable MTOM for JAX-WS web services.
- (Optional) Enforce adherence to WSDL bindings in JAX-WS web services.
- (Optional) Develop and configure a webservices.xml deployment descriptor for JAX-WS applications.
- Complete the implementation of the web service application.
- (Optional) Customize URL patterns in web.xml.
- Assemble the artifacts for the web service.
- Deploy the EAR file into the application server.
- Test the web service to verify the service works with the application server.
Related concepts
JAX-WS
Related tasks
Set up a development environment for web services Generating Java artifacts for JAX-WS applications from a WSDL file Enable MTOM for JAX-WS web services Enforcing adherence to WSDL bindings in JAX-WS web services Develop a webservices.xml deployment descriptor for JAX-WS applications Complete the JavaBeans implementation for JAX-WS applications Complete the EJB implementation for JAX-WS applications Customize URL patterns in web.xml for JAX-WS applications Assembling web services applications Deploy web services applications onto application servers Test web services-enabled clients Use HTTP to transport web services Use SOAP over JMS to transport web services Example: Install a web services sample with the console Implement web services applications with JAX-WS
Artifacts used to develop web services Web services specifications and APIs Contexts and Dependency Injection (CDI)
Related information:
JAX-WS API documentation
JAX-WS API User's Guide documentation