Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Property

Description

name

Specifies the name of the service interface. This property is mapped to the name attribute of the wsdl:portType element that defines the service's interface in a WSDL contract. The default is to append PortType to the name of the implementation class.

targetNamespace

Specifies the target namespace under which the service is defined. If this property is not specified, the target namespace is derived from the package name.

serviceName

Specifies the name of the published service. This property is mapped to the name attribute of the wsdl:service element that defines the published service. The default is to use the name of the service's implementation class. Note: Not allowed on the SEI

wsdlLocation

Specifies the URI at which the service's WSDL contract is stored. The default is the URI at which the service is deployed.

endpointInterface

Specifies the full name of the SEI that the implementation class implements. This property is only used when the attribute is used on a service implementation class. Note: Not allowed on the SEI

portName

Specifies the name of the endpoint at which the service is published. This property is mapped to the name attribute of the wsdl:port element that specifies the endpoint details for a published service. The default is the append Port to the name of the service's implementation class. Note: Not allowed on the SEI

Tip
titleTip

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

...

Code Block
titleExample4:Interface with the @WebService Annotation
package com.iona.demo;

import javax.jws.*;

@WebService(name="quoteUpdater",
            targetNamespace="http:\\//cxf.apache.org",
            wsdlLocation="http:\\//somewhere.com\/quoteExampleService?wsdl")
public interface quoteReporterQuoteReporter
{
  public Quote getQuote(@WebParam(name="ticker") String ticker);
}

...

  1. Specifies that the value of the name attribute of the wsdl:portType element defining the service interface is quoteUpdater.
  2. Specifies that the target namespace of the service is {{http:
    //cxf.apache.org}}Image Added.
  3. Specifies that the value of the name of the wsdl: service element defining the published service is updateQuoteService.Specifies that the service will use the pre-defined WSDL contract which is published at http:\\//somewhere.com\/quoteExampleService?wsdlImage Added.
  4. Specifies that the value of the name attribute of the wsdl:port element defining the endpoint exposing the service is updateQuotePort.

The @WebParam annotation is necessary as java interfaces do not store the Parameter name The @WebParam annotation is necessary as java interfaces do not store the Parameter name in the .class file. So if you leave out the annotation your parameter will be named arg0.

...

Code Block
titleExample5:Annotated Service Implementation Class
package org.apache.cxf;

import javax.jws.*;

@WebService(endpointInterface="org.apache.cxf.quoteReporter",
            targetNamespace="http://cxf.apache.org",
            portName="StockQuotePort",
            serviceName="StockQuoteReporter",
            )
public class stockQuoteReporterStockQuoteReporter implements quoteReporterQuoteReporter
{
public Quote getQuote(String ticker)
  {
  ...
  }
}

...