Announcement Announcement Module
Collapse
No announcement yet.
'IllegalArgumentException: SOAPElement expected' with XmlBeans Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 'IllegalArgumentException: SOAPElement expected' with XmlBeans

    Hi,

    I use XmlBeans (2.3.0) as a (un)marshaller in Spring Web Services. A request is properly processed, but returned response causes:

    Code:
    2007-09-23 17:41:41,015 DEBUG [org.myname.webservice.ChangeUserPasswordMarshallingEndpoint] Marshalling [<ChangeUserPas
    swordResponse xmlns="http://www.myname.org/schemas">
      <Token>whatTheHellIsIt</Token>
    </ChangeUserPasswordResponse>] to response payload
    2007-09-23 17:41:41,096 DEBUG [org.springframework.ws.soap.server.SoapMessageDispatcher] Testing endpoint exception resolver 
    [org.springframework.ws.soap.server.endpoint.SimpleSoapExceptionResolver@135b50c]
    2007-09-23 17:41:41,126 WARN  [SoapMessageDispatcher] Endpoint invocation resulted in exception - responding with SOAP Fault
    java.lang.IllegalArgumentException: SOAPElement expected
            at org.jboss.ws.core.soap.SOAPBodyImpl.convertToBodyElement(SOAPBodyImpl.java:266)
            at org.jboss.ws.core.soap.SOAPBodyImpl.appendChild(SOAPBodyImpl.java:188)
            at org.springframework.oxm.xmlbeans.XmlBeansMarshaller.marshalDomNode(XmlBeansMarshaller.java:98)
            at org.springframework.oxm.AbstractMarshaller.marshalDomResult(AbstractMarshaller.java:190)
            at org.springframework.oxm.AbstractMarshaller.marshal(AbstractMarshaller.java:86)
            at org.springframework.ws.support.MarshallingUtils.marshal(MarshallingUtils.java:76)
            at org.springframework.ws.server.endpoint.AbstractMarshallingPayloadEndpoint.marshalResponse(AbstractMarshallingPayloadEndpoint.java:150)
            at org.springframework.ws.server.endpoint.AbstractMarshallingPayloadEndpoint.invoke(AbstractMarshallingPayloadEndpoint.java:134)
            at org.springframework.ws.server.endpoint.adapter.MessageEndpointAdapter.invoke(MessageEndpointAdapter.java:41)
            at org.springframework.ws.server.MessageDispatcher.dispatch(MessageDispatcher.java:211)
            at org.springframework.ws.server.MessageDispatcher.receive(MessageDispatcher.java:158)
            at org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:87)
            at org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:57)
            at org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:158)
            at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:475)
            at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:440)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    Response displayed above an exception by an interceptor looks ok.

    My endpoint is very simple:
    Code:
    public class ChangeUserPasswordMarshallingEndpoint extends AbstractMarshallingPayloadEndpoint {
    
        public ChangeUserPasswordMarshallingEndpoint(Marshaller marshaller) {
            super(marshaller);
        }
    
        protected Object invokeInternal(Object object) throws Exception {
            ChangeUserPasswordRequestDocument cupReqDoc = (ChangeUserPasswordRequestDocument) object;
            ChangeUserPasswordRequestDocument.ChangeUserPasswordRequest cupReq = cupReqDoc.getChangeUserPasswordRequest();
    
            /* ... */
    
            ChangeUserPasswordResponseDocument cupResDoc = ChangeUserPasswordResponseDocument.Factory.newInstaclassnce();
            ChangeUserPasswordResponseDocument.ChangeUserPasswordResponse cupRes = cupResDoc.addNewChangeUserPasswordResponse();
            cupRes.setToken("whatTheHellIsIt");
            return cupResDoc;
        }
    Mentioned ChangeUserPassword classes was generated from xsd:
    Code:
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
            elementFormDefault="qualified"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            targetNamespace="http://www.myname.org/schemas"
            xmlns:ss="http://www.myname.org/schemas">
    
        <!-- ... -->
        <xs:element name="ChangeUserPasswordResponse">
            <xs:complexType>
                <xs:all>
                    <xs:element name="Token" type="xsd:string"/>
                </xs:all>
            </xs:complexType>
        </xs:element>
    </xs:schema>
    My Spring-WS configuration:
    Code:
        <bean class="org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping">
            <property name="mappings">
                <props>
                    <prop key="{http://www.myname.org/schemas}ChangeUserPasswordRequest">changeUserPasswordMarshallingEndpoint</prop>
                </props>
            </property>
            <property name="interceptors">
                <bean class="org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor"/>
            </property>
        </bean>
    
        <bean id="changeUserPasswordMarshallingEndpoint" class="org.myname.spotspam.webservice.ChangeUserPasswordMarshallingEndpoint">
            <constructor-arg ref="marshaller"/>
        </bean>
    
        <bean id="marshaller" class="org.springframework.oxm.xmlbeans.XmlBeansMarshaller"/>
    Do you know what can cause the problem?

    Marcin
    Last edited by Szpak; Sep 23rd, 2007, 12:04 PM. Reason: Correction in a subject

  • #2
    Once again SAAJ in JBoss was a problem.
    http://static.springframework.org/sp...tml#saaj-jboss helped me.

    Comment

    Working...
    X