Java Reference
In-Depth Information
public class GetTemperaturesResponse {
private List<TemperatureInfo> temperatures;
// Constructors, Getters and Setters
With the object model created, you can write a marshalling endpoint by extending the
AbstractMarshallingPayloadEndpoint class. The core method defined in this class that you must
override is invokeInternal() . In this method, you can access the request object, which is unmarshalled
from the request message, as the method argument. Now all you have to do in this method is handle the
request object and return the response object. Then it will be marshalled to the response XML message.
Note To create a service endpoint using Castor, you have to copy castor-1. 2.jar (located in the
lib/castor directory of the Spring-WS installation) and xercesImpl-2.8.1.jar (located in lib/xerces ) to the
WEB-INF/lib directory.
public class TemperatureMarshallingEndpoint extends
AbstractMarshallingPayloadEndpoint {
private WeatherService weatherService;
public void setWeatherService(WeatherService weatherService) {
this.weatherService = weatherService;
protected Object invokeInternal(Object requestObject) throws Exception {
GetTemperaturesRequest request = (GetTemperaturesRequest) requestObject;
List<TemperatureInfo> temperatures =
weatherService.getTemperatures(request.getCity(), request.getDates());
return new GetTemperaturesResponse(temperatures);
Search WWH ::

Custom Search