Hello,
I am using Spring2.5.6 and Castor 1.3.1 for my webservice. I have used
Source generator to generate my java classes from XSD. Everything is working
fine in the local server(WAS on RAD). But when i deploy it on the server, It
is complaining that it cannot find castor generated classes. I am not sure
what is wrong. I am using Maven to manage dependencies from a repository of
jars.
<code>
<bean id="webServiceTemplate"
class="org.springframework.ws.client.core.WebServiceTemplate">
<constructor-arg ref="messageFactory" />
<property name="defaultUri" value="${uri}" />
<property name="marshaller" ref="marshaller" />
<property name="unmarshaller" ref="marshaller" />
</bean>
<bean id="marshaller"
class="org.springframework.oxm.castor.CastorMarshaller" />
</code>
Then i wrote a class to extend CastorMarshaller as below. This class adds
the castor generated descriptor package to the XMLContext. But i still get
the same problem. After receiving XML message, when castor tries to convert
it to java object, it throws an exception saying castor generated classes
cannot be found.
<code>
public class CustomCastorMarshaller extends CastorMarshaller {
protected XMLContext createXMLContext(Resource[] mappingLocations,
Class targetClass) throws MappingException, IOException,
ResolverException {
XMLContext context = new XMLContext();
logger.debug("Adding org.aamc.amspullservice.oxm.castor package
to
XMLContext");
context.addPackages(new String[] {
"org.test.oxm.castor.descriptors" });
if (!ObjectUtils.isEmpty(mappingLocations)) {
Mapping mapping = new Mapping();
for (int i = 0; i < mappingLocations.length; i++) {
mapping.loadMapping(SaxUtils
.createInputSource(mappingLocations[i]));
}
context.addMapping(mapping);
}
if (targetClass != null) {
context.addClass(targetClass);
}
return context;
}
}
</code>
<code>
<bean id="marshaller" class="org.test.CustomCastorMarshaller " />
</code>
Note: i have .castor.cdr file in my castor generated package. Any help would
be greatly appreciated.
--
View this message in context:
http://old.nabble.com/castor-generated-descriptors-with-Spring-tp29280360p29280360.html
Sent from the Castor - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email