Java Reference
In-Depth Information
<bean id="marshaller"
class="org.springframework.oxm.castor.CastorMarshaller">
<property name="mappingLocation" value="classpath:mapping.xml" />
</bean>
</beans>
5-13. Creating Service Endpoints with Annotations
Problem
By extending a Spring-WS base endpoint class, your endpoint class will be bound to the Spring-WS class
hierarchy, and each endpoint class will only be able to handle one type of web service request.
Solution
Spring-WS supports annotating an arbitrary class as a service endpoint by the @Endpoint annotation,
without extending a framework-specific class. You can also group multiple handler methods in an
endpoint class so that it can handle multiple types of web service requests.
How It Works
For example, you can annotate your temperature endpoint with the @Endpoint annotation so that it
doesn't need to extend a Spring-WS base endpoint class. The signature of the handler methods can also
be more flexible.
package com.apress.springenterpriserecipes.weather;
...
import org.springframework.ws.server.endpoint.annotation.Endpoint;
import org.springframework.ws.server.endpoint.annotation.PayloadRoot;
@Endpoint
public class TemperatureMarshallingEndpoint {
private static final String namespaceUri =
" http://springenterpriserecipes.apress.com/weather/schemas" ;
private WeatherService weatherService;
public void setWeatherService(WeatherService weatherService) {
this.weatherService = weatherService;
}
@PayloadRoot(
localPart = "GetTemperaturesRequest",
namespace = namespaceUri)
 
Search WWH ::




Custom Search