private void parseSoap12Fault ( Document soapMessage , PrintWriter logger ) throws Exception { Element envelope = soapMessage . getDocumentElement ( ) ; Element code = DomUtils . getElementByTagNameNS ( envelope , SOAP_12_NAMESPACE , "Code" ) ; String value = DomUtils . getElementByTagNameNS ( code , SOAP_12_NAMESPACE , "Value" ) . getTextContent ( ) ; String msg = "SOAP Fault received - [code:" + value + "]" ; Element subCode = DomUtils . getElementByTagNameNS ( code , SOAP_12_NAMESPACE , "Subcode" ) ; if ( subCode != null ) { value = DomUtils . getElementByTagNameNS ( subCode , SOAP_12_NAMESPACE , "Value" ) . getTextContent ( ) ; msg += "[subcode:" + value + "]" ; } Element reason = DomUtils . getElementByTagNameNS ( envelope , SOAP_12_NAMESPACE , "Reason" ) ; Element text = DomUtils . getElementByTagNameNS ( reason , SOAP_12_NAMESPACE , "Text" ) ; if ( text != null ) { value = text . getTextContent ( ) ; msg += "[reason:" + value + "]" ; } logger . println ( msg ) ; }
A method to parse a SOAP 1 . 2 fault message .