0

I have a middleware which can accept the SOAP request and well as can make SOAP request.

I have written the custom interceptors to intercept the inbound and outbound request to log them in database.

The issue is that when a SOAP request is made the incoming request is intercepted by InBound interceptor and when my module makes the SOAP request it is intercepted by Outbound interceptor which is correct.

But I would like to Identify the incoming SOAP message as weather it is SOAP request or SOAP response so that I can log the SOAP request and Response correctly.

Is there a way to identify the SOAP message as request or response ?

NullPointerException
  • 3,732
  • 5
  • 28
  • 62

2 Answers2

1

You can always get the headers and look for the TCP header if there is a Request Method of say POST for a SOAP call

fpmoles
  • 1,209
  • 8
  • 14
1

You can also use CXF MessageUtils class to do that. For e.g.:

boolean requestor = MessageUtils.isRequestor(message);
boolean outbound = MessageUtils.isOutbound(message);
if (requestor) {
    if (!outbound) {
        //This is your RESPONSE message
    }
} else {
    if (!outbound) {
        //This is your REQUEST message
    }
}
Paulius Matulionis
  • 23,085
  • 22
  • 103
  • 143