protected void handleInboundSoapHeaders ( final org . springframework . ws . soap . SoapMessage soapMessage , final SoapMessage message ) { try { final SoapHeader soapHeader = soapMessage . getSoapHeader ( ) ; if ( soapHeader != null ) { final Iterator < ? > iter = soapHeader . examineAllHeaderElements ( ) ; while ( iter . hasNext ( ) ) { final SoapHeaderElement headerEntry = ( SoapHeaderElement ) iter . next ( ) ; MessageHeaderUtils . setHeader ( message , headerEntry . getName ( ) . getLocalPart ( ) , headerEntry . getText ( ) ) ; } if ( soapHeader . getSource ( ) != null ) { final StringResult headerData = new StringResult ( ) ; final TransformerFactory transformerFactory = TransformerFactory . newInstance ( ) ; final Transformer transformer = transformerFactory . newTransformer ( ) ; transformer . transform ( soapHeader . getSource ( ) , headerData ) ; message . addHeaderData ( headerData . toString ( ) ) ; } } if ( StringUtils . hasText ( soapMessage . getSoapAction ( ) ) ) { if ( soapMessage . getSoapAction ( ) . equals ( "\"\"" ) ) { message . setHeader ( SoapMessageHeaders . SOAP_ACTION , "" ) ; } else { if ( soapMessage . getSoapAction ( ) . startsWith ( "\"" ) && soapMessage . getSoapAction ( ) . endsWith ( "\"" ) ) { message . setHeader ( SoapMessageHeaders . SOAP_ACTION , soapMessage . getSoapAction ( ) . substring ( 1 , soapMessage . getSoapAction ( ) . length ( ) - 1 ) ) ; } else { message . setHeader ( SoapMessageHeaders . SOAP_ACTION , soapMessage . getSoapAction ( ) ) ; } } } } catch ( final TransformerException e ) { throw new CitrusRuntimeException ( "Failed to read SOAP header source" , e ) ; } }
Reads all soap headers from web service message and adds them to message builder as normal headers . Also takes care of soap action header .