Announcement Announcement Module
Collapse
No announcement yet.
Could not access envelope: Disallowed element found inside Envelope Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Could not access envelope: Disallowed element found inside Envelope

    Hello,
    I am trying to access a secure webservice using username and password Token but I am getting the following error:

    Code:
    Could not access envelope: Disallowed element found inside Envelope : {http://www.w3.org/2003/05/soap-envelope}Body
    Could anyone help me on this forum by telling me what I am doing wrong?

    Below is the full stacktrace.
    Any help on this will be very much appreciated.
    Thanks

    Code:
    Mar 11, 2011 12:25:16 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
    INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@1b48197: startup date [Fri Mar 11 12:25:16 CST 2011]; root of context hierarchy
    Mar 11, 2011 12:25:16 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
    INFO: Loading XML bean definitions from class path resource [spring-ws-client.xml]
    Mar 11, 2011 12:25:17 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
    INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@eb7331: defining beans [customerServiceProxy,xbeans,messageSender,messageFactory,webServiceTemplate,callbackHandler,wss4jSecurityInterceptor]; root of factory hierarchy
    Mar 11, 2011 12:25:17 PM org.springframework.ws.soap.saaj.SaajSoapMessageFactory afterPropertiesSet
    INFO: Creating SAAJ 1.3 MessageFactory with SOAP 1.1 Protocol
    Mar 11, 2011 12:25:17 PM org.springframework.ws.soap.axiom.AxiomSoapMessageFactory afterPropertiesSet
    INFO: Enabled payload caching
    org.springframework.ws.soap.axiom.AxiomSoapBodyException: Could not access envelope: Disallowed element found inside Envelope : {http://www.w3.org/2003/05/soap-envelope}Body; nested exception is org.apache.axiom.soap.SOAPProcessingException: Disallowed element found inside Envelope : {http://www.w3.org/2003/05/soap-envelope}Body
            at org.springframework.ws.soap.axiom.AxiomSoapEnvelope.getBody(AxiomSoapEnvelope.java:95)
            at org.springframework.ws.soap.AbstractSoapMessage.getSoapBody(AbstractSoapMessage.java:36)
            at org.springframework.ws.soap.AbstractSoapMessage.hasFault(AbstractSoapMessage.java:56)
            at org.springframework.ws.client.core.WebServiceTemplate.hasFault(WebServiceTemplate.java:673)
            at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:553)
            at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:496)
            at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:343)
            at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:337)
    
    Caused by: org.apache.axiom.soap.SOAPProcessingException: Disallowed element found inside Envelope : {http://www.w3.org/2003/05/soap-envelope}Body
            at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.constructNode(StAXSOAPModelBuilder.java:352)
            at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createOMElement(StAXSOAPModelBuilder.java:273)
            at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createNextOMElement(StAXSOAPModelBuilder.java:234)
            at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:249)
            at org.apache.axiom.om.impl.llom.OMElementImpl.buildNext(OMElementImpl.java:653)
            at org.apache.axiom.om.impl.llom.OMElementImpl.getFirstOMChild(OMElementImpl.java:670)
            at org.apache.axiom.om.impl.llom.OMElementImpl.getFirstElement(OMElementImpl.java:891)
            at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.getBody(SOAPEnvelopeImpl.java:165)
            at org.springframework.ws.soap.axiom.AxiomSoapEnvelope.getBody(AxiomSoapEnvelope.java:81)
            ... 9 more
    Here is a snippet of my config file:

    Code:
     <bean id="customerServiceProxy" class="poc.client.CustomerServiceProxy" />
    <bean id="xbeans" class="org.springframework.oxm.xmlbeans.XmlBeansMarshaller" />
    <bean id="messageSender" class="org.springframework.ws.transport.http.CommonsHttpMessageSender"/>
        <bean id="messageFactory" class="org.springframework.ws.soap.axiom.AxiomSoapMessageFactory"/>
        <bean id="webServiceTemplate" class="org.springframework.ws.client.core.WebServiceTemplate"
    		p:marshaller-ref="xbeans"
    		p:unmarshaller-ref="xbeans"
    		p:defaultUri="${url}"
    		p:messageSender-ref="messageSender">
            <constructor-arg ref="messageFactory"/>
            <property name="interceptors">
                <list>
                    <ref local="wss4jSecurityInterceptor"/>
                </list>
            </property>
        </bean>
    
     <bean id="callbackHandler" class="org.springframework.ws.soap.security.wss4j.callback.SimplePasswordValidationCallbackHandler">
            <property name="users">
                <props>
                    <prop key="uid">pass</prop>
                </props>
            </property>
        </bean>
    
    
        <bean id="wss4jSecurityInterceptor"
      class="org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor">
      <!-- The web service provider requires us to pass a timestamp,
        username, and password -->
            <property name="securementActions" value="UsernameToken" />
            <property name="securementUsername" value="uid" />
            <property name="securementPassword" value="pass" />
      <!-- When the web service replies, it will send a timestamp,
        username, and password as well. We want to verify that it is still
        the same provider -->
            <property name="validationActions" value="UsernameToken"/>
            <property name="validationCallbackHandler" ref="callbackHandler" />
        </bean>
    Last edited by emmanuel; Mar 11th, 2011, 01:42 PM.

  • #2
    Please help me resolve this issue.
    I really need to solve this issue so I can move on in my project.
    Thanks

    Comment


    • #3
      You may need to set payload caching to true on your AxiomMessageFactory. I had similar troubles and that solved it.

      Comment

      Working...
      X