THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
Table of Contents |
---|
Developing a Service using JAX-WS
...
Code Block | ||
---|---|---|
| ||
package com.iona.demo; import javax.jws.*; @WebService(name="quoteUpdater", targetNamespace="http:\\cxf.apache.org", serviceName="updateQuoteService", wsdlLocation="http:\\cxf.apache.org\quoteExampleService?wsdl", portName="updateQuotePort") public interface quoteReporter { public Quote getQuote(@WebParam(name="ticker") String ticker); } |
The @WebService
annotation in #Example4 does the following:
- Specifies that the value of the name attribute of the
wsdl:portType
element defining the service interface isquoteUpdater
. - Specifies that the target namespace of the service is
http:
.
cxf.apache.org - Specifies that the value of the name of the
wsdl:service
element defining the published service isupdateQuoteService
. - Specifies that the service will publish its WSDL contract at
http:\\cxf.apache.org\quoteExampleService?wsdl
. - Specifies that the value of the name attribute of the
wsdl:port
element defining the endpoint exposing the service isupdateQuotePort
.
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.
Annotating the service implementation
...