Announcement Announcement Module
Collapse
No announcement yet.
PayloadRootQNameEndpointMapping with Wss4jSecurityInterceptor raises SOAPProcessingEx Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • PayloadRootQNameEndpointMapping with Wss4jSecurityInterceptor raises SOAPProcessingEx

    Hi,

    I am experiencing trouble with using PayloadRootQNameEndpointMapping with Wss4jSecurityInterceptor. My configuration is as
    Code:
    <bean id="endpointMapping" class="org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping">
        <property name="mappings">
            <props>
                <prop key="{http://com/company/mywebservice/}employeeById_Request">serviceEndPoint</prop>
                <prop key="{http://com/company/mywebservice/}employeeByFile_Request">serviceEndPoint</prop>
                <prop key="{http://com/company/mywebservice/}employeeBySecurity_Request">serviceEndPoint</prop>
            </props>
        </property>
        <property name="interceptors">
            <list>
                <bean class="org.springframework.ws.soap.server.endpoint.interceptor.SoapEnvelopeLoggingInterceptor"/>
                <ref local="wsSecurityInterceptor"/> 
            </list>
        </property>
    </bean>
    
    <bean id="wsSecurityInterceptor" class="org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor">
        <property name="validationActions" value="UsernameToken" />
        <property name="validationCallbackHandler" ref="springSecurityHandler" />
    </bean>
    
    <bean id="springSecurityHandler"
      class="org.springframework.ws.soap.security.wss4j.callback.SpringPlainTextPasswordValidationCallbackHandler">
        <property name="authenticationManager" ref="authenticationManager"/>
    </bean>
    When no interceptor is provided,
    Code:
    <!--<ref local="wsSecurityInterceptor"/> -->
    It works fine. But if above line is active, that is interceptor is provided, it gives error
    Code:
    <<||2013-07-14 10:06:30,281||http-apr-8080-exec-32|DEBUG|org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor:486||||>> Validating message [AxiomSoapMessage {http://com/company/mywebservice/}employeeBySecurity_Request] with actions [UsernameToken] 
    <<||2013-07-14 10:06:30,282||http-apr-8080-exec-32|DEBUG|org.apache.axiom.om.util.StAXUtils:370||||>> XMLStreamWriter is org.apache.axiom.util.stax.dialect.WoodstoxStreamWriterWrapper 
    <<||2013-07-14 10:06:30,283||http-apr-8080-exec-32|DEBUG|org.apache.axiom.om.impl.MTOMXMLStreamWriter:196||||>> Calling MTOMXMLStreamWriter.flush 
    <<||2013-07-14 10:06:30,285||http-apr-8080-exec-32|DEBUG|org.apache.ws.security.WSSecurityEngine:230||||>> enter processSecurityHeader() 
    <<||2013-07-14 10:06:30,286||http-apr-8080-exec-32|DEBUG|org.apache.ws.security.WSSecurityEngine:241||||>> Processing WS-Security header for '' actor. 
    <<||2013-07-14 10:06:30,287||http-apr-8080-exec-32|DEBUG|org.apache.ws.security.processor.UsernameTokenProcessor:50||||>> Found UsernameToken list element 
    <<||2013-07-14 10:06:30,287||http-apr-8080-exec-32|DEBUG|org.apache.ws.security.processor.UsernameTokenProcessor:94||||>> UsernameToken user test 
    <<||2013-07-14 10:06:30,288||http-apr-8080-exec-32|DEBUG|org.apache.ws.security.processor.UsernameTokenProcessor:95||||>> UsernameToken password password 
    <<||2013-07-14 10:06:30,288||http-apr-8080-exec-32|DEBUG|org.springframework.security.providers.ProviderManager:190||||>> Authentication attempt using org.springframework.security.providers.dao.DaoAuthenticationProvider 
    <<||2013-07-14 10:06:30,289||http-apr-8080-exec-32|DEBUG|org.springframework.ws.soap.security.wss4j.callback.SpringPlainTextPasswordValidationCallbackHandler:78||||>> Authentication success: org.springframework.security.providers.UsernamePasswordAuthenticationToken@f478c279: Principal: org.springframework.security.userdetails.User@fc52b100: Username: test; Password: [PROTECTED]; Enabled: true; AccountNonExpired: true; credentialsNonExpired: true; AccountNonLocked: true; Granted Authorities: ROLE_ADMIN; Password: [PROTECTED]; Authenticated: true; Details: null; Granted Authorities: ROLE_ADMIN 
    <<||2013-07-14 10:06:30,296||http-apr-8080-exec-32|DEBUG|org.apache.ws.security.WSSecurityEngine:343||||>> processHeader: total 9, prepare 0, handle 9 
    <<||2013-07-14 10:06:30,304||http-apr-8080-exec-32|DEBUG|org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder:316||||>> Starting to process SOAP 1.1 message 
    <<||2013-07-14 10:06:30,305||http-apr-8080-exec-32|DEBUG|org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder:273||||>> Build the OMElement Envelope by the StaxSOAPModelBuilder 
    <<||2013-07-14 10:06:30,306||http-apr-8080-exec-32|DEBUG|org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder:273||||>> Build the OMElement Header by the StaxSOAPModelBuilder 
    <<||2013-07-14 10:06:30,307||http-apr-8080-exec-32|DEBUG|org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder:273||||>> Build the OMElement Security by the StaxSOAPModelBuilder 
    <<||2013-07-14 10:06:30,307||http-apr-8080-exec-32|DEBUG|org.springframework.ws.server.MessageDispatcher:273||||>> Testing endpoint adapter [org.springframework.ws.server.endpoint.adapter.MessageEndpointAdapter@64541242] 
    <<||2013-07-14 10:06:30,309||http-apr-8080-exec-32|DEBUG|org.apache.axiom.soap.impl.llom.SOAPHeaderImpl:426||||>> org.apache.axiom.soap.SOAPProcessingException: An attempt was made to add a normal OMElement as a child of a SOAPHeader.  This is not supported.  The child should be a SOAPHeaderBlock.
    	at org.apache.axiom.soap.impl.llom.SOAPHeaderImpl.addChild(SOAPHeaderImpl.java:423)
    	at org.apache.axiom.om.impl.llom.OMNodeImpl.<init>(OMNodeImpl.java:74)
    	at org.apache.axiom.om.impl.llom.OMElementImpl.<init>(OMElementImpl.java:104)
    	at org.springframework.ws.server.endpoint.AbstractMarshallingPayloadEndpoint.unmarshalRequest(AbstractMarshallingPayloadEndpoint.java:143)
    	at org.springframework.ws.server.endpoint.AbstractMarshallingPayloadEndpoint.invoke(AbstractMarshallingPayloadEndpoint.java:129)
    	at org.springframework.ws.server.endpoint.adapter.MessageEndpointAdapter.invoke(MessageEndpointAdapter.java:41)
    	at org.springframework.ws.server.MessageDispatcher.dispatch(MessageDispatcher.java:221)
    	at org.springframework.ws.server.MessageDispatcher.receive(MessageDispatcher.java:168)
    	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:647)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    
    <<||2013-07-14 10:06:30,315||http-apr-8080-exec-32|DEBUG|org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder:273||||>> Build the OMElement UsernameToken by the StaxSOAPModelBuilder 
    <<||2013-07-14 10:06:30,315||http-apr-8080-exec-32|DEBUG|org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder:273||||>> Build the OMElement Username by the StaxSOAPModelBuilder 
    <<||2013-07-14 10:06:30,316||http-apr-8080-exec-32|DEBUG|org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder:273||||>> Build the OMElement Password by the StaxSOAPModelBuilder 
    <<||2013-07-14 10:06:30,316||http-apr-8080-exec-32|DEBUG|org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder:273||||>> Build the OMElement Nonce by the StaxSOAPModelBuilder 
    <<||2013-07-14 10:06:30,316||http-apr-8080-exec-32|DEBUG|org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder:273||||>> Build the OMElement Created by the StaxSOAPModelBuilder 
    <<||2013-07-14 10:06:30,318||http-apr-8080-exec-32|DEBUG|org.springframework.web.servlet.FrameworkServlet:588||||>> Could not complete request 
    java.lang.IllegalArgumentException: No faultCode given
    	at org.springframework.util.Assert.notNull(Assert.java:112)
    	at org.springframework.ws.soap.axiom.AxiomSoap11Body.addFault(AxiomSoap11Body.java:73)
    	at org.springframework.ws.soap.server.endpoint.AbstractSoapFaultDefinitionExceptionResolver.resolveExceptionInternal(AbstractSoapFaultDefinitionExceptionResolver.java:89)
    	at org.springframework.ws.server.endpoint.AbstractEndpointExceptionResolver.resolveException(AbstractEndpointExceptionResolver.java:84)
    	at org.springframework.ws.server.MessageDispatcher.processEndpointException(MessageDispatcher.java:311)
    	at org.springframework.ws.server.MessageDispatcher.dispatch(MessageDispatcher.java:235)
    	at org.springframework.ws.server.MessageDispatcher.receive(MessageDispatcher.java:168)
    	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)
    I guess while finding the endpointadapter for this request it is unable, as the message also contains soap security header. But I am not sure. I have visited many web posts to get this but had no luck. Please let me know if somewhere it is wrong or, any proper way to PayloadRootQNameEndpointMapping with Wss4jSecurityInterceptor working

    My config also has,

    Code:
    <bean id="messageFactory" class="org.springframework.ws.soap.axiom.AxiomSoapMessageFactory">
    	    <property name="payloadCaching" value="true" />
    	    <property name="attachmentCaching" value="true" />
    	    <property name="attachmentCacheThreshold" value="1024"/>
    	</bean>
    defined,

    If I remove this then its working fine and I guess it is using SAAJ. So is there something to be done with Wss4jSecurityInterceptor for AXIOM?

    Thanks
    Last edited by chakri; Jul 14th, 2013, 12:30 AM. Reason: working fine I remove AXIOM

  • #2
    Any suggestions please...

    In AbstractMarshallingPayloadEndpoint of spring-ws at

    Code:
    public final void invoke(MessageContext messageContext) throws Exception {
            WebServiceMessage request = messageContext.getRequest();
            Object requestObject = unmarshalRequest(request);
            if (onUnmarshalRequest(messageContext, requestObject)) {
                Object responseObject = invokeInternal(requestObject);
                if (responseObject != null) {
                    WebServiceMessage response = messageContext.getResponse();
                    marshalResponse(responseObject, response);
                    onMarshalResponse(messageContext, requestObject, responseObject);
                }
            }
        }
    in the message context, the request is an AXIOM message with soap:body=null. Is it like as there is an interceptor the message is already read and later the body is set null/empty in AxiomSoapMessage. the log is
    Code:
    <<||2013-07-15 23:35:10,191||http-apr-8080-exec-42|DEBUG|org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder:273||||>> Build the OMElement Nonce by the StaxSOAPModelBuilder 
    <<||2013-07-15 23:35:10,191||http-apr-8080-exec-42|DEBUG|org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder:273||||>> Build the OMElement Created by the StaxSOAPModelBuilder 
    <<||2013-07-15 23:35:10,193||http-apr-8080-exec-42|DEBUG|org.springframework.web.servlet.FrameworkServlet:588||||>> Could not complete request 
    java.lang.IllegalArgumentException: No faultCode given
    	at org.springframework.util.Assert.notNull(Assert.java:112)
    	at org.springframework.ws.soap.axiom.AxiomSoap11Body.addFault(AxiomSoap11Body.java:73)
    	at org.springframework.ws.soap.server.endpoint.AbstractSoapFaultDefinitionExceptionResolver.resolveExceptionInternal(AbstractSoapFaultDefinitionExceptionResolver.java:89)
    	at org.springframework.ws.server.endpoint.AbstractEndpointExceptionResolver.resolveException(AbstractEndpointExceptionResolver.java:84)
    	at org.springframework.ws.server.MessageDispatcher.processEndpointException(MessageDispatcher.java:311)
    	at org.springframework.ws.server.MessageDispatcher.dispatch(MessageDispatcher.java:235)
    	at org.springframework.ws.server.MessageDispatcher.receive(MessageDispatcher.java:168)
    	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:647)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    on debugging, Attachment

    Please post suggestions

    Thanks
    Attached Files
    Last edited by chakri; Jul 15th, 2013, 01:11 PM. Reason: Guessing empty body in axiom message

    Comment


    • #3
      Is the discussion at http://xfory.com/thread-50804-1-1.html is somehow applicable here?
      I am really struck, please provide suggestions... Thanks in advance
      Last edited by chakri; Jul 16th, 2013, 02:56 AM. Reason: found related discussion

      Comment


      • #4
        Resolved and works fine with version,

        <groupId>org.springframework.ws</groupId>
        <artifactId>spring-ws-core</artifactId>
        <version>2.0.0.RELEASE</version>

        Thanks

        Comment

        Working...
        X