Details
-
Type:
Sub-task
-
Status:
Closed
-
Priority:
Major
-
Resolution: Won't Fix
-
Affects Version/s: None
-
Fix Version/s: 1.2
-
Component/s: XML code generator
-
Labels:None
-
Number of attachments :
Description
Hi,
This in continuation to my previous question.
The reason to use mapping file is : Without mapping file , marshalling works but not unmarshalling. While unmarshalling, it searches for the corresponding class for root of the xml. If mapping file is not provided it raises an exception.
The exception raised is on the server side is:
Caused by: org.xml.sax.SAXException: The class for the root element 'EmployeeRequest' could not be found.
at org.exolab.castor.xml.UnmarshalHandler.startElement(UnmarshalHandler.
java:1527)
at org.exolab.castor.xml.UnmarshalHandler.startElement(UnmarshalHandler.
java:1430)
at org.exolab.castor.xml.util.DOMEventProducer.process(DOMEventProducer.
java:246)
at org.exolab.castor.xml.util.DOMEventProducer.process(DOMEventProducer.
java:183)
at org.exolab.castor.xml.util.DOMEventProducer.start(DOMEventProducer.ja
va:111)
at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:617)
I am using spring webservices. Initially i have generated classes and class descriptors for the xsd. Next i have marshalled the object and send it to server by using webservicetemplate.
EmployeeResponse response = (EmployeeResponse) webServiceTemplate
.marshalSendAndReceive(employeeRequest);
Whereas in config.xml file the configurations are: (Client side configurations)
<bean id="webServiceTemplate"
class="org.springframework.ws.client.core.WebServiceTemplate">
<property name="messageFactory" ref="messageFactory" />
<property name="defaultUri"
value="http://localhost:8080/empService/" />
<property name="messageSender" ref="urlMessageSender" />
<property name="marshaller" ref="marshaller" />
<property name="unmarshaller" ref="marshaller" />
</bean>
<bean id="marshaller" class="org.springframework.oxm.castor.CastorMarshaller"/>
Whereas in service -config.xml file the configurations are: (Service side configurations)
<bean id="saveEmpEndpoint"
class="com.hr.ws.SaveEmpEndpoint">
<property name="marshaller" ref="marshaller" />
<property name="unmarshaller" ref="marshaller" />
<property name="saveEmpService" ref="saveEmpService" />
</bean>
<bean id="marshaller"
class="org.springframework.oxm.castor.CastorMarshaller">
</bean>
My SaveEmpEndpoint class extends AbstractMarshallingPayloadEndpoint
I am attaching xsd for your reference.
Thanks in advance.