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

  • SOAPElement expected

    Hey folks,

    At the moment I am trying to run a webservice in a JBoss server (version 4.2.3). Running the same webservice in Jetty goes just fine; no problems. But in JBoss I receive a pretty nasty error as a SOAP reply:

    java.lang.IllegalArgumentException: SOAPElement expected


    About my project, I'm using JDK 1.5, Maven (3), XMLBeans, Spring WS (1.5.9) and JBoss (4.3.2). The webservice is pretty simple: get a request, retrieve params from it, create a response SOAP message, use an interceptor to catch that response SOAP message, add custom headers to it and send it back to the SOAP client.

    I've come across a few similar problems and they pointed out that SAAJ could be a problem. I've tried to 'force' the usage of the SAAJ classes I provided (with Maven) by using a messageFactory element in the spring-ws-servlet.xml. But when using that, I get internal errors from JBoss (and Jetty).

    Here's some code, for those who might be interested in it.


    My webservice endpoint:
    Code:
    public class MyEndpoint extends AbstractMarshallingPayloadEndpoint {
    
    	public MyEndpoint(Marshaller marshaller) {
    		super(marshaller);
    	}
    
    	@Override
    	protected Object invokeInternal(Object soapRequest) throws Exception {
    		RequestDelegator delegator = new RequestDelegator();
    		return delegator.processSoapRequestObject(soapRequest);
    	}
    }


    My spring-ws-servlet.xml (I ommitted the standard namespaces and other irrelevant stuff):
    Code:
    	<bean id="myEndpoint" class="com.company.webservice.endpoints.MyEndpoint">
    		<constructor-arg ref="marshaller" />
    	</bean>
    
    	<bean id="marshaller" class="org.springframework.oxm.xmlbeans.XmlBeansMarshaller">
    	</bean>
    
    	<bean class="org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping">
    		<property name="mappings">
    			<props>
    				<prop key="{http://schemas.company.com/messages/defaulttestrequest}DefaultTestRequest">myEndpoint</prop>
    			</props>
    		</property>
    		<property name="interceptors">
    			<list>
    				<ref bean="headerInterceptor" />
    			</list>
    		</property>
    	</bean>
    
    	<bean id="headerInterceptor" class="com.company.webservice.interceptors.HeaderInterceptor" />


    This is my HTTP transport definition bean, which I disabled now because of the crashes it causes.
    Code:
    <bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory">
    		<property name="messageFactory">
    			<bean class="com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl" />
    		</property>
    	</bean>


    When looking into the log file it seems that the interceptor is not even reached. The error occurs somewhere right after the response SOAP object has been created (and send back to the Spring framework/marshaller). I know this because I added some System.out messages to the interceptor class and endpoint. The endpoint is fully processed, the interceptor is never reached on JBoss (but it is on Jetty, though).

    Oh, I run the jetty along with maven (mvn jetty:run). Just for your info.


    Anyone knows where it goes wrong and what to do?







    Below the exception I receive in the console:
    Code:
    2011-03-01 14:53:55,239 DEBUG [org.springframework.ws.soap.server.endpoint.SimpleSoapExceptionResolver] Resolving exception from endpoint [[email protected]b9e9a3]: java.lang.IllegalArgumentException: SOAPElement expected
    2011-03-01 14:53:55,250 DEBUG [org.springframework.ws.soap.server.SoapMessageDispatcher] Endpoint invocation resulted in exception - responding with Fault
    java.lang.IllegalArgumentException: SOAPElement expected
    	at org.jboss.ws.core.soap.SOAPBodyImpl.convertToBodyElement(SOAPBodyImpl.java:284)
    	at org.jboss.ws.core.soap.SOAPBodyImpl.appendChild(SOAPBodyImpl.java:202)
    	at org.springframework.oxm.xmlbeans.XmlBeansMarshaller.marshalDomNode(XmlBeansMarshaller.java:98)
    	at org.springframework.oxm.AbstractMarshaller.marshalDomResult(AbstractMarshaller.java:192)
    	at org.springframework.oxm.AbstractMarshaller.marshal(AbstractMarshaller.java:88)
    	at org.springframework.ws.support.MarshallingUtils.marshal(MarshallingUtils.java:84)
    	at org.springframework.ws.server.endpoint.AbstractMarshallingPayloadEndpoint.marshalResponse(AbstractMarshallingPayloadEndpoint.java:170)
    	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:228)
    	at org.springframework.ws.server.MessageDispatcher.receive(MessageDispatcher.java:170)
    	at org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:88)
    	at org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:57)
    	at org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:230)
    	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
    	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:511)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    	at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    	at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
    	at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    	at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
    	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
    	at java.lang.Thread.run(Thread.java:595)
    2011-03-01 14:53:55,250 DEBUG [org.springframework.ws.server.MessageTracing.sent] Sent response [SaajSoapMessage {http://schemas.xmlsoap.org/soap/envelope/}Fault] for request [SaajSoapMessage {http://schemas.company.com/messages/MyRequest}MyRequest]
    2011-03-01 14:53:55,263 DEBUG [org.springframework.ws.transport.http.MessageDispatcherServlet] Successfully completed request

  • #2
    At the moment I have got this issue solved, I guess. As I am using Maven, I included a few dependencies that implement SAAJ.
    The webservice deployed on the server used another SAAJ jar (probably the one of JBoss or IBM JRE) and that did give me a lot of trouble.

    But I'm not sure yet whether it helped, because I got another error right now. A different error (I opened another topic for it), but still related to the mismatch between the JAR files.

    Comment

    Working...
    X