Java Reference
In-Depth Information
Then you can simply define a Jsr181HandlerMapping bean to map the web service requests to
appropriate service beans according to the JSR-181 annotations. To make the mappings consistent with
before, you should set the urlPrefix property to / , so that it will be added in front of the service names
specified in the annotation. Remember that you also have to inject the core xfire bean into this handler
<beans ...>
<bean id="weatherService"
class="" />
<bean class="org.codehaus.xfire.spring.remoting.Jsr181HandlerMapping">
<property name="xfire" ref="xfire" />
<property name="webAnnotations">
<bean class="org.codehaus.xfire.annotations.jsr181.Jsr181
WebAnnotations" />
<property name="urlPrefix" value="/" />
5-9. Defining the Contract of Web Services
According to the contract-first web service approach, the first step of developing a web service is to
define the service contract.
A web service's contract consists of two parts: the data contract and the service contract. They are both
defined with the XML technology in a platform- and language-independent way.
Data contract : Describes the complex data types and request and response messages of this web
service. A data contract is typically defined with XSD, although you can also use DTDs, RELAX NG,
or Schematron.
Service contract : Describes the operations of this web service. A web service may have multiple
operations. A service contract is defined with WSDL.
When using a comprehensive web service development framework like Spring-WS, the service
contract can usually be generated automatically. But you must create the data contract yourself.
To create the data contract for your web service, you can start by creating the XSD file. Because
there are many powerful XML tools available in the community, this won't be too hard. However,
most developers prefer to start by creating some sample XML messages, and then generate the XSD
file from them. Of course, you need to optimize the generated XSD file yourself, as it may not fit your
requirements entirely, and sometimes you may wish to add more constraints to it.
Search WWH ::

Custom Search