Search code examples
spring-integrationspring-ws

Spring Integration Log SOAP Message Content of int-ws:outbound-gateway


Could you tell me how to log the SOAP Message send/received of int-ws:outbound-gateway ?

I have tried

<int-ws:outbound-gateway id="ais-outbound-gateway"
    request-channel="aisRequestChannel" reply-channel="aisResponseChannel"
    uri="http://localhost:8080/services/ONESHOT" 
    marshaller="aisMarshaller"        unmarshaller="aisMarshaller" /> 

<int:channel id="aisRequestChannel">
    <int:interceptors>
        <int:wire-tap channel="logChannel"/>
    </int:interceptors>
</int:channel>   
<int:channel id="aisResponseChannel">
    <int:interceptors>
        <int:wire-tap channel="logChannel"/>
    </int:interceptors>
</int:channel>

<int:logging-channel-adapter expression="payload" id="logChannel" level="DEBUG"  />

But the payload is just java object, not SOAP message.

Best regards,


Solution

  • The <int-ws:outbound-gateway> supports interceptor injection:

    <xsd:documentation>
        Reference to the bean definition of a ClientInterceptor.
    </xsd:documentation>
    

    So, you should implement your own LoggingClientInterceptor.

    The logging ideas you can borrow from the existing PayloadLoggingInterceptor.