Web Services for Java EE specification
The Web Services for Java EE specification defines the programming model and runtime architecture for implementing web services based on the Java language. Another name for the Web Services for Java EE specification is the JSR 109 The specification includes open standards for developing and implementing web services.
The Web Services for Java EE specification is based on the Java EE technology and supports the JAX-WS and JAX-RPC programming model for web services and clients in a manner that is interoperable and portable across application servers within environments that are scalable and secure. This specification is based on industry standards for web services, including WSDL and SOAP, and it describes the development and deployment of web services.
The application server supports the Web Services for Java EE specification, Version 1.3. This specification supports WSDL Version 1.1, SOAP Version 1.1 and SOAP Version 1.2.
We can integrate the Java EE technology with web services in a variety of ways. We can expose Java EE components as web services, for example, JavaBeans and enterprise beans. When you expose Java EE components as web services, clients that are written in Java code or existing web service clients that are not written in Java code can access these services. Java EE components can also act as web service clients.
The Web Services for Java EE specification is the preferred platform for Web-based programming because it provides open standards permitting different types of languages, operating systems and software to communicate seamlessly through the Internet.
For a Java application to act as web service client, a mapping between the WSDL file and the Java application must exist. For JAX-WS applications, the mapping is defined using annotations. We can optionally use webservices.xml to specify the location of the WSDL file and override the value defined in the @WebServices annotation. For JAX-RPC applications, define the JAX-RPC mapping file. To learn more about the mapping defined between the WSDL file and the web service application, see the JAX-WS specification or the JAX-RPC specification in the web services specifications and API documentation depending on the programming model used.
We can use a Java component to implement a Web service by specifying the component interface and binding information in the WSDL file, and designing the application server infrastructure to accept the service request.
This entire process encompassed is based on the Web Services for Java EE specification.
The webservices.xml file defines the set of web services we can deploy in a Web Services for Java EE enabled container.
For JAX-WS web services, using webservices.xml is optional. We can use annotations to specify all of the information contained within the deployment descriptor file. We can use the deployment descriptor file to augment or override existing JAX-WS annotations. Information defined in webservices.xml overrides any corresponding information specified by annotations.
For example, if the service implementation class for the JAX-WS web service includes the @WebService annotation:
@WebService(wsdlLocation="http://myhost.com/location/of/the/wsdl/ExampleService.wsdl")
...and the webservices.xml specifies a different filename for the WSDL document as follows:
<webservices> <webservice-description> <webservice-description-name>ExampleService</webservice-description-name> <wsdl-file>META-INF/wsdl/ExampleService.wsdl</wsdl-file> </webservice-description> </webservices>
...then the value specified in the deployment descriptor...
META-INF/wsdl/ExampleService.wsdl
...overrides the annotation value.
See section 5 of the Web Services for Java EE specification for details regarding the correlation between values specified in the web services deployment descriptor file and the attributes of the @WebService and the @WebServiceProvider annotations.
For JAX-RPC web services, define the deployment characteristics in webservices.xml file.
We are responsible for providing various elements to the deployment descriptor, including:
- Port name
- Port service implementation
- Port service endpoint interface
- Port WSDL definition
- Port QName
- MTOM/XOP support for JAX-WS web services
- Protocol binding for JAX-WS web services
- JAX-RPC mapping
- Handlers (Optional)
- Servlet mapping (Optional)
The EJB 2.1 specification also states that for a web service developed from a session bean, the EJB deployment descriptor, ejb-jar.xml, must contain the service-endpoint element. The service-endpoint value must be the same as that stated in the webservices.xml deployment descriptor.
Related concepts
JAX-WS- JAX-RPC
- WSDL
- Web services specifications and APIs