private boolean simulateHttpStatusCode ( Message replyMessage ) throws IOException { if ( replyMessage == null || CollectionUtils . isEmpty ( replyMessage . getHeaders ( ) ) ) { return false ; } for ( Entry < String , Object > headerEntry : replyMessage . getHeaders ( ) . entrySet ( ) ) { if ( headerEntry . getKey ( ) . equalsIgnoreCase ( SoapMessageHeaders . HTTP_STATUS_CODE ) ) { WebServiceConnection connection = TransportContextHolder . getTransportContext ( ) . getConnection ( ) ; int statusCode = Integer . valueOf ( headerEntry . getValue ( ) . toString ( ) ) ; if ( connection instanceof HttpServletConnection ) { ( ( HttpServletConnection ) connection ) . setFault ( false ) ; ( ( HttpServletConnection ) connection ) . getHttpServletResponse ( ) . setStatus ( statusCode ) ; return true ; } else { log . warn ( "Unable to set custom Http status code on connection other than HttpServletConnection (" + connection . getClass ( ) . getName ( ) + ")" ) ; } } } return false ; }
If Http status code is set on reply message headers simulate Http error with status code . No SOAP response is sent back in this case .