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 Java Specification Requirements (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.
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 we 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 the webservices.xml deployment descriptor 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 that is 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.
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 specification defines the webservices.xml deployment descriptor specifically for web services. The webservices.xml deployment descriptor file defines the set of web services that we can deploy in a Web Services for Java EE enabled container.
For JAX-WS web services, the use of the webservices.xml deployment descriptor is optional because we can use annotations to specify all of the information contained within the deployment descriptor file. Use the deployment descriptor file to augment or override existing JAX-WS annotations. Any information defined in the webservices.xml deployment descriptor overrides any corresponding information specified by annotations.
For example, if your service implementation class for our JAX-WS web service includes the @WebService annotation as follows:
@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 the webservices.xml deployment descriptor 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.
For a complete list of the supported standards and specifications, see the web services specifications and API documentation.
Related:
JAX-WS JAX-RPC WSDL Web services specifications and APIs