Java Reference
In-Depth Information
Specifying Namespaces
Problem
You are starting from Java, and want to indicate the namespace(s) your service should define
in the generated WSDL because you don't care for the default.
Solution
Use the targetNamespace property of the @WebService annotation to indicate the namespace
for the web service itself.
Discussion
The targetNamespace property is optional. If you do not use it, your service will get assigned
a namespace that is an inversion of the package name your implementation class is in. For
example, if your class is in the package com.soacookbook.ch04 , the default namespace for
your service will be http://ch04.soacookbook.com/ . This property allows you to override
the default with whatever you like.
You can also use the targetNamespace property on other items beside the service. Both the
@WebResult and @WebParam annotations take a targetNamespace . Each of them either comes
from schema originally or match have schema representations generated, so their namespaces
do not have to match, nor do they have to match the service namespace.
If you do not specify a namespace for web params or web results, they will inherit the target
namespace for the service.
If you want to specify the empty namespace, use @WebParam(targetNamespace="") .
NOTE
It is a best practice to use separate namespaces for your WSDL and your schemas.
Search WWH ::




Custom Search