Web Services for Java EE specification
The Web Services for Java EE v1.2 specification defines the model and runtime architecture for implementing Web services based on the Java language. Another name for the Web Services for Java EE spec is JSR 109.
The Web Services for Java EE v1.2 spec supports...
Prior to Web Services for Java EE v1.2, the JSR 109 spec name was Web Services for J2EE.
We can expose Java EE components such as Java Beans and enterprise beans as Web services. When Java EE components are exposed as Web services, clients written in Java code or existing Web service clients that are not written in Java code can access these services.
For a Java application to act as Web service client, create a mapping between the WSDL file and the Java application.
- 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.
For JAX-WS, the use of webservices.xml is optional because we can use annotations to specify all of the information contained within the webservices.xml. Use webservices.xml to augment or override existing JAX-WS annotations. Information defined in webservices.xml overrides corresponding information specified by annotations.
For example, if the service implementation class includes the @WebService annotation...
@WebService(wsdlLocation="http://myhost.com/location/of/the/wsdl/ExampleService.wsdl")...and webservices.xml specifies a different filename for the WSDL document...
<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 webservices.xml overrides the annotation value.
For JAX-RPC Web services, define the deployment characteristics in webservices.xml.
Elements of webservices.xml include...
- 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)
For Web services developed from EJB 2.1 session beans, ejb-jar.xml must contain the service-endpoint element, and the value must be the same as that in webservices.xml.
Related concepts
JAX-WS
JAX-RPC
Related
Web services specifications and APIs