Developing a webservices.xml deployment descriptor for JAX-WS applications

Deployment descriptors are standard text files, formatted using XML and packaged in a web services application. You can optionally use the webservices.xml deployment descriptor to augment or override application metadata specified in annotations within Java API for XML-Based Web Services (JAX-WS) web services.

About this task

Similar to Java API for XML-based RPC (JAX-RPC) Web services, you can use deployment descriptors to describe JAX-WS web services. For JAX-WS web services, the use of the webservices.xml deployment descriptor is optional because you can use annotations to specify all of the information that is contained within the deployment descriptor file. You can use the deployment descriptor file to augment or override existing JAX-WS annotations. Any information that you define in the webservices.xml deployment descriptor overrides any corresponding information that is specified by annotations.

A JAX-WS web service requires that you annotate your Java class with the javax.jws.WebService annotation or the javax.jws.WebServiceProvider annotation for Provider endpoints. You can use server-side deployment descriptors to override corresponding attributes of the annotation or to enhance information in annotations. There is a defined relationship between the deployment descriptor elements and the @WebService and @WebServiceProvider annotations. Refer to section 5.3 in the Web Services for Java Platform, Enterprise Edition (Java EE) specification, Version 1.2 for detailed information regarding the deployment descriptor elements and the mapping to the @WebService and @WebServiceProvider annotation attributes. There are also elements in the webservice.xml deployment descriptor that map to other annotations. For example, the deployment descriptor element <protocol-binding> maps to the @BindingType annotation, and the deployment descriptor element <enable-mtom> maps to the @MTOM annotation. For more information regarding the web services deployment descriptor elements, see section 7.1 in the Web Services for Java Platform, Enterprise Edition (Java EE) specification.

Procedure

Use assembly tools to generate the webservice.xml deployment descriptor.

Results

You have deployment descriptor templates that you can use to override JAX-WS annotation attributes or specify attributes that are not defined by the annotation.

Example

In the following example, the service implementation class for a JAX-WS web service includes the @WebService annotation:
@WebService(wsdlLocation=”http://myhost.com/location/of/the/wsdl/ExampleService.wsdl”)
The associated webservices.xml deployment descriptor 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>
The value that is specified in the deployment descriptor, META-INF/wsdl/ExampleService.wsdl, overrides the annotation value.

What to do next

Configure the webservice.xml deployment descriptor. After you configure the deployment descriptors, you must assemble the Web services application for deployment.

Task topic    

Terms and conditions for information centers | Feedback

Last updated: April 17, 2014 04:48 PM CDT
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=phil&product=was-base-iseries&topic=twbs_jaxwsdeploydescriptor
File name: twbs_jaxwsdeploydescriptor.html