Java Reference
In-Depth Information
Using JAX-WS Annotation Name Properties
Problem
You want to know what the impact of changing certain annotation properties that refer to
names of some kind will be on your overall design.
Solution
Read the following Discussion section.
Discussion
In general, naming can be tricky with JAX-WS. There are many properties of web service
name variations that do not directly indicate how setting their values will impact your service
and clients, and even the specification does not clearly and state the practical ramifications of
populating certain JAX-WS annotation properties. The listings below should clarify some of
the most common cases.
WebService.targetNamespace
@WebService(targetNamespace="http://ns.soacookbook.com",
name="CatalogService")
The @WebService annotation indicates that a Java class implements a web service. If used on
an interface, it serves as a web service interface definition. A service endpoint interface maps
to a wsdl:portType element. In a @WebService annotation, the targetNamespace property
changes the namespace your service will be defined in. The WSDL for a class with the an-
notation just shown reads like this:
<definitions targetNamespace="http://ns.soacookbook.com"
name="CatalogService">
If you do not specify a WebService.targetNamespace property, the default used in its place
will be the reverse of the package name. For example:
<definitions targetNamespace="http://ch03.soacookbook.com/"
WebService.name
@WebService(targetNamespace="http://ns.soacookbook.com",
name="CatalogService")
Search WWH ::




Custom Search