Java Reference
In-Depth Information
To implement endpoints with an XML marshalling technology, you have to extend the
AbstractMarshallingPayloadEndpoint class and configure an XML marshaller for it. Table 5-3 lists
the marshallers provided by Spring-WS for different XML marshalling APIs.
Table 5-3. Marshallers for Different XML Marshalling APIs
API
Marshaller
org.springframework.oxm.jaxb.Jaxb1Marshaller
JAXB 1.0
org.springframework.oxm.jaxb.Jaxb2Marshaller
JAXB 2.0
Castor
org.springframework.oxm.castor.CastorMarshaller
org.springframework.oxm.xmlbeans.XmlBeansMarshaller
XMLBeans
org.springframework.oxm.jibx.JibxMarshaller
JiBX
org.springframework.oxm.xstream.XStreamMarshaller
XStream
To invoke a web service, WebServiceTemplate also allows you to choose an XML marshalling
technology to process the request and response XML messages.
How It Works
Creating Service Endpoints with XML Marshalling
Spring-WS supports various XML marshalling APIs, including JAXB 1.0, JAXB 2.0, Castor, XMLBeans, JiBX,
and XStream. As an example, I will create a service endpoint using Castor ( http://www.castor.org/ ) as the
marshaller. Using other XML marshalling APIs is very similar.
The first step in using XML marshalling is creating the object model according to the XML message
formats. This model can usually be generated by the marshalling API. For some marshalling APIs, the
object model must be generated by them so that they can insert marshalling-specific information.
Because Castor supports marshalling between XML messages and arbitrary Java objects, you can start
creating the following classes by yourself.
package com.apress.springenterpriserecipes.weather;
...
public class GetTemperaturesRequest {
private String city;
private List<Date> dates;
// Constructors, Getters and Setters
...
}
Search WWH ::




Custom Search