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="org.springframework.ws.server.endpoint.
mapping.PayloadRootAnnotationMethodEndpointMapping" />
<bean id="temperatureEndpoint"
class="com.apress.springenterpriserecipes.weather.Temperature
MarshallingEndpoint">
<property name="weatherService" ref="weatherService" />
</bean>
<bean class="org.springframework.ws.server.endpoint.adapter.
GenericMarshallingMethodEndpointAdapter">
<property name="marshaller" ref="marshaller" />
<property name="unmarshaller" ref="marshaller" />
</bean>
<bean id="marshaller"
class="org.springframework.oxm.castor.CastorMarshaller">
<property name="mappingLocation" value="classpath:mapping.xml" />
</bean>
</beans>
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.
Summary
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