Java Reference
In-Depth Information
A marshalling endpoint requires both the marshaller and unmarshaller properties to be set. Usually,
you can specify a single marshaller for both properties. For Castor, you declare a CastorMarshaller bean
as the marshaller.
<beans ...>
<bean id="temperatureEndpoint"
<property name="marshaller" ref="marshaller" />
<property name="unmarshaller" ref="marshaller" />
<property name="weatherService" ref="weatherService" />
<bean id="marshaller"
<property name="mappingLocation" value="classpath:mapping.xml" />
Note that Castor requires a mapping configuration file to know how to map objects to and from
XML documents. You can create this file in the classpath root and specify it in the mappingLocation
property (e.g., mapping.xml ). The following Castor mapping file defines the mappings for the
GetTemperaturesRequest , GetTemperaturesResponse , and TemperatureInfo classes:
<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN"
"" >
<class name="">
<map-to xml="GetTemperaturesRequest"
ns-uri="" />
<field name="city" type="string">
<bind-xml name="city" node="element" />
<field name="dates" collection="arraylist" type="string"
<bind-xml name="date" node="element" />
<class name="
<map-to xml="GetTemperaturesResponse"
ns-uri="" />
<field name="temperatures" collection="arraylist"
<bind-xml name="TemperatureInfo" node="element" />
Search WWH ::

Custom Search