Book Image

EJB 3 Developer Guide

By : Michael Sikora
Book Image

EJB 3 Developer Guide

By: Michael Sikora

Overview of this book

Table of Contents (18 chapters)
EJB 3 Developer Guide
Credits
About the Author
About the Reviewers
Preface
Annotations and Their Corresponding Packages

Overriding JAX-WS Annotation Defaults


In this section we revisit the Arithmetic endpoint implementation class and override some of the defaults. Below is the new listing of Arithmetic with the modifications highlighted:

package endpoint;
import javax.jws.WebService;
import javax.jws.WebMethod;
@WebService(
name="Maths",
service
Name="MathsWebService",
targetNamespace="http://wsimport")
public class Arithmetic {
public Arithmetic() {}
@WebMethod(
operationName="product")
public int multiply(int a, int b) {
int c = a * b ;
return c;
}
}

First we look at some of the properties of the @WebService annotation. The name property sets the name associated with the WSDL port type. This defaults to the Java class or interface name, Arithmetic in our case.

The serviceName property sets the WSDL service name as indicated by the <service> element. The default is the Java class name with "Service" appended, ArithmeticService in our case.

The targetNamespace property sets the XML namespace for WSDL...