Announcement Announcement Module
Collapse
No announcement yet.
Spring Web Service - Problem using XMLBeansMarshaller Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Web Service - Problem using XMLBeansMarshaller

    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...

  • #2
    Hi Did u find the solution to the problem I am also facing the problem of Cast exception , I have not tried the change in the configuration file . As Iwas not sure about
    <prop key="DOCUMENT_TYPE">com.mycompany.hr.schemas.Holid ayRequestDocument.type</prop>

    What value should be present in the Value of that property

    Comment


    • #3
      Check this article might be it will be helpful to you ..
      http://hubpages.com/hub/Spring_Web_Service

      Comment

      Working...
      X