PayloadRootQNameEndpointMapping与Wss4jSecurityInterceptor导致SOAPProcessingException

时间:2013-07-13 17:46:30

标签: java spring-security spring-ws wss4j

我正在使用以下配置,对于使用Wss4jSecurityInterceptor的PayloadRootQNameEndpointMapping

<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>

                                                  

当没有提供拦截器时,

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

工作正常。但如果上面的行是活动的,那就是提供了拦截器,它会给出错误

.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)

请分析是否有错误,或者使用Wss4jSecurityInterceptor配置spring-ws PayloadRootQNameEndpointMapping的正确方法

由于

1 个答案:

答案 0 :(得分:0)

我认为spring-ws 1.5.6版本有一些错误,我切换到版本2.0.0并且工作正常