Results 1 to 3 of 3

Thread: Spring Web Service - Problem using XMLBeansMarshaller

  1. #1

    Default 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. #2
    Join Date
    Mar 2009
    Posts
    6

    Default

    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

  3. #3

    Default

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •