Java Reference
In-Depth Information
In a @WebService annotation, the name property changes the portname on your generated
@WebServiceClient classes. As a consequence, the following method will become available
on your service client:
service.getCatalogServicePort
The element @javax.jws.WebService.name cannot be used with the element
@javax.jws.WebService.endpointInterface .
If you do not specify a @WebService.name property, it will default to the class name. For ex-
ample:
@WebService(serviceName="CatalogService",
targetNamespace="http://ns.soacookbook.com")
public class CatalogWS implements Catalog { ... }
requires client code like this:
private CatalogService service;
CatalogWS port = service.getCatalogWSPort();
It is important to differentiate between the generated stub, which is an interface annotated with
@WebService (and which gets its name from the value of the name property in the @WebSer-
vice annotation on the class that actually does implement the business logic of the web ser-
vice), and the actual class implementation, if you are operating with a web service client and
provider in the same JVM, as you might with a servlet.
WebService.serviceName
This property defines the URL of your deployed service. For example, the following @We-
bService annotation above a class:
package com.soacookbook.ch03;
//...
@WebService(serviceName="CatalogServiceSN",
targetNamespace="http://ns.soacookbook.com")
will generate the following deployed URL:
http://localhost:8080/soaCookbookWS/CatalogServiceSN?wsdl
This also modifies the name of the generated service class. That same @WebService annota-
tion also generates the following when you execute wsimport :
@WebServiceClient(name = "CatalogServiceSN",
targetNamespace = "http://ns.soacookbook.com",
wsdlLocation = "http://localhost:8080/soaCookbookWS/
CatalogServiceSN?wsdl")
Search WWH ::




Custom Search