Java Reference
In-Depth Information
public GetTemperaturesResponse getTemperature(GetTemperaturesRequest request) {
List<TemperatureInfo> temperatures =
weatherService.getTemperatures(request.getCity(), request.getDates());
return new GetTemperaturesResponse(temperatures);
Besides the @Endpoint annotation, you have to annotate each handler method with the
@PayloadRoot annotation for mapping a service request. In this annotation, you specify the local
name ( localPort ) and namespace of the payload root element to be handled. Then you just declare a
PayloadRootAnnotationMethodEndpointMapping bean, and it will be able to detect the mapping from the
@PayloadRoot annotation automatically.
<beans ...>
</bean class="
mapping.PayloadRootAnnotationMethodEndpointMapping" />
<bean id="temperatureEndpoint"
<property name="weatherService" ref="weatherService" />
<bean class="
<property name="marshaller" ref="marshaller" />
<property name="unmarshaller" ref="marshaller" />
<bean id="marshaller"
<property name="mappingLocation" value="classpath:mapping.xml" />
Because your endpoint class no longer extends a base endpoint class, it doesn't inherit
the capabilities of marshalling and unmarshalling XML messages. You have to configure a
GenericMarshallingMethodEndpointAdapter to do so.
This chapter discussed how to use Spring's remoting support. You learned how to set up an RMI service
and about Spring's support for classic EJB and EJB3 services. Spring-WS, Spring's excellent support for
web service creation, was also discussed.
In the next chapter, you will see some Spring framework tools for everyday requirements such as
scheduling and sending e-mail.
Search WWH ::

Custom Search