PayloadRootQNameEndpointMapping with Wss4jSecurityInterceptor causing SOAPProcessingException

孤者浪人 提交于 2019-12-11 13:04:22

问题


I am using below configuration, for PayloadRootQNameEndpointMapping with Wss4jSecurityInterceptor

<bean id="endpointMapping" class="org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping">
    <property name="mappings">
        <props>
            <prop key="{http://com/clickandbuy/mywebservice/}employeeById_Request">serviceEndPoint</prop>
            <prop key="{http://com/clickandbuy/mywebservice/}employeeByFile_Request">serviceEndPoint</prop>
            <prop key="{http://com/clickandbuy/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,

 <!--<ref local="wsSecurityInterceptor"/> -->

It works fine. But if above line is active, that is interceptor is provided, it gives error

.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder:316||||>> Starting to process SOAP          1.1 message 
<<||2013-07-13 22:36:57,922||http-apr-8080-exec-      35|DEBUG|org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder:273||||>> Build the    OMElement Envelope by the StaxSOAPModelBuilder 
<<||2013-07-13 22:36:57,923||http-apr-8080-exec-35|DEBUG|org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder:273||||>> Build the OMElement Header by the StaxSOAPModelBuilder 
<<||2013-07-13 22:36:57,923||http-apr-8080-exec-35|DEBUG|org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder:273||||>> Build the OMElement Security by the StaxSOAPModelBuilder 
<<||2013-07-13 22:36:57,924||http-apr-8080-exec-35|DEBUG|org.springframework.ws.server.MessageDispatcher:273||||>> Testing endpoint adapter [org.springframework.ws.server.endpoint.adapter.MessageEndpointAdapter@6e369c05] 
<<||2013-07-13 22:36:57,925||http-apr-8080-exec-35|DEBUG|org.apache.axiom.soap.impl.llom.SOAPHeaderImpl:426||||>>     org.apache.axiom.soap.SOAPProcessingException: An attempt was made to add a normal OMEl    ement 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)

Please share if something is wrong, or any proper way to configure spring-ws PayloadRootQNameEndpointMapping with Wss4jSecurityInterceptor

Thanks


回答1:


I think there was some error with spring-ws 1.5.6 version, I switched to version 2.0.0 and it works fine



来源:https://stackoverflow.com/questions/17632687/payloadrootqnameendpointmapping-with-wss4jsecurityinterceptor-causing-soapproces

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!