Hi
I am trying to use XMLBeansMarsahller in my spring web services project.
This is the invokeInternal method of my endpoint class:
protected Object invokeInternal(Object arg0) throws Exception {
try{
HolidayRequestDocument requestDoc = (HolidayRequestDocument)arg0;
.....
......
}catch (Exception e){
e.printStackTrace();
}
This was my earlier configuration in the spring-ws-servlet.xml file:
<bean id="marshaller" class="org.springframework.oxm.xmlbeans.XmlBeansMa rshaller" />
<bean id="holidayEndpoint" class="com.mycompany.hr.ws.HolidayEndpointWithXMLB eans">
<constructor-arg ref="marshaller"></constructor-arg>
</bean>
With this above configuration I was getting following ClassCastException:
java.lang.ClassCastException: org.apache.xmlbeans.impl.values.XmlAnyTypeImpl cannot be cast to com.mycompany.hr.schemas.HolidayRequestDocument
Then I read the javadocs related to XMLBeansMarshaller and changed my spring-ws-servlet.xml file to supply XMLOptions to the marsahller.
This is the new configuration in my spring-ws-servlet.xml file:
<bean id="marshaller" class="org.springframework.oxm.xmlbeans.XmlBeansMa rshaller" >
<property name="xmlOptions" ref="xmlOptions" />
</bean>
<bean id="xmlOptions" class="org.springframework.oxm.xmlbeans.XmlOptions FactoryBean">
<property name="options">
<props>
<prop key="DOCUMENT_TYPE">com.mycompany.hr.schemas.Holid ayRequestDocument.type</prop>
</props>
</property>
</bean>
<bean id="holidayEndpoint" class="com.mycompany.hr.ws.HolidayEndpointWithXMLB eans">
<constructor-arg ref="marshaller"></constructor-arg>
</bean>
With this configuration I am getting the following SOAPFault:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server</faultcode>
<faultstring xml:lang="en">Can't overwrite cause</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
With this new configuration execution is not even going to the invokeInternal method of my endpoint.
Is my new configuration correct?
How to resolve this error?
Thanks in advance...


Reply With Quote