LibraryToggle FramesPrintFeedback

The @WebService annotation is defined by the javax.jws.WebService interface and it is placed on an interface or a class that is intended to be used as a service. @WebService has the properties described in Table 1.1


It is not necessary to provide values for any of the @WebService annotation's properties. However, it is recommended that you provide as much information as you can.

The SEI requires that you add the @WebService annotation. Because the SEI is the contract that defines the service, you should specify as much detail as possible about the service in the @WebService annotation's properties.

Example 1.3 shows the interface defined in Example 1.1 with the @WebService annotation.

Example 1.3. Interface with the @WebService Annotation

package com.fusesource.demo;

import javax.jws.*;

@WebService(name="quoteUpdater", 1
            targetNamespace="http:\\", 2
	        serviceName="updateQuoteService", 3
            wsdlLocation="http:\\\quoteExampleService?wsdl", 4
            portName="updateQuotePort") 5
public interface quoteReporter
  public Quote getQuote(String ticker);

The @WebService annotation in Example 1.3 does the following:


Specifies that the value of the name attribute of the wsdl:portType element defining the service interface is quoteUpdater.


Specifies that the target namespace of the service is http:\\


Specifies that the value of the name of the wsdl:service element defining the published service is updateQuoteService.


Specifies that the service will publish its WSDL contract at http:\\\quoteExampleService?wsdl.


Specifies that the value of the name attribute of the wsdl:port element defining the endpoint exposing the service is updateQuotePort.

Comments powered by Disqus
loading table of contents...