Skip to main content Skip to complementary content

Annotating the SEI

About this task

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

The below shows the interface defined in above with the @WebService annotation.

Interface with the @WebService Annotation

package com.mycompany.demo;

import javax.jws.*;

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

The @WebService annotation above does the following:

Procedure

  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.
  3. Specifies that the service will use the pre-defined WSDL contract published at http://somewhere.com/quoteExampleService?wsdl.

Results

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.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!