code4kix
code4kix

Reputation: 4187

Spring Integration - Need to Map SOAP Headers

In spring-int 4.1, I had the header-mapper working fine, like so:

<int-ws:inbound-gateway id="my-gateway" 
    request-channel="my-gateway-input" 
    reply-channel="my-gateway-output"
    unmarshaller="jaxb2Marshaller" marshaller="jaxb2Marshaller"
    header-mapper="soapHeaderMapper" />
<beans:bean id="soapHeaderMapper" class="org.springframework.integration.ws.DefaultSoapHeaderMapper">
   <beans:property name="requestHeaderNames" value="*"/>
</beans:bean>

When I try to upgrade to spring-int 4.2, the header-mapper is not allowed. The reason why I need it is because I need the soap security header to be mapped. But I don't think it is being mapped without specifying the soapHeaderMapper. Note that I do have the following upstream to intercept the soap request and I am pretty sure the interceptor is not removing the soap header. Let me know if you need the complete config.

<beans:bean id="wss4jSecurityInterceptor" class="org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor">
    <beans:property name="validationActions" value="UsernameToken"/>
    <beans:property name="validationCallbackHandler" ref="validationCallbackHandler"></beans:property>
    <beans:property name="removeSecurityHeader" value="false"></beans:property>
</beans:bean>

Upvotes: 1

Views: 638

Answers (1)

Artem Bilan
Artem Bilan

Reputation: 121177

No-op.

That still works.

Why do you think that header-mapper is ignored?

We have this test config:

<ws:inbound-gateway id="headerMappingGateway" request-channel="headerMappingRequests"
        header-mapper="testHeaderMapper"/>

And the test-case on the matter:

@Autowired
private SimpleWebServiceInboundGateway headerMappingGateway;

@Autowired
private SoapHeaderMapper testHeaderMapper;

@Test
public void testHeaderMapperReference() throws Exception {
    DirectFieldAccessor accessor = new DirectFieldAccessor(headerMappingGateway);
    Object headerMapper = accessor.getPropertyValue("headerMapper");
    assertEquals(testHeaderMapper, headerMapper);
}

So, everything should work as it was with Spring Integration 4.1.

Otherwise, please, share the test-case to reproduce.

We appreciate any feedback!

P.S. I see, of course, that we have an XSD miss-typing with expected and what is really allowed. But that doesn't prevent to use any possible custom SoapHeaderMapper implementation.

Upvotes: 1

Related Questions