1
2
3
4
5
6
7
8
9
10
11
12
13 package com.eviware.soapui.impl.wsdl.support.soap;
14
15 import org.apache.xmlbeans.XmlException;
16 import org.apache.xmlbeans.XmlObject;
17
18 import com.eviware.soapui.support.StringUtils;
19
20 /***
21 * SOAP-related utility-methods..
22 *
23 * @author ole.matzura
24 */
25
26 public class SoapUtils
27 {
28 public static boolean isSoapFault( String responseContent, SoapVersion soapVersion ) throws XmlException
29 {
30 if( StringUtils.isNullOrEmpty( responseContent ))
31 return false;
32
33
34 if( responseContent.indexOf( ":Fault" ) > 0 || responseContent.indexOf( "<Fault" ) > 0 )
35 {
36 XmlObject xml = XmlObject.Factory.parse( responseContent );
37 XmlObject[] paths = xml.selectPath( "declare namespace env='" + soapVersion.getEnvelopeNamespace() + "';" +
38 "//env:Fault");
39 if( paths.length > 0 )
40 return true;
41 }
42
43 return false;
44 }
45 }