-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSoapException.java
More file actions
39 lines (32 loc) · 1.34 KB
/
SoapException.java
File metadata and controls
39 lines (32 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package javaxt.webservices;
//******************************************************************************
//** SoapException Class
//******************************************************************************
/**
* Custom error thrown when parsing a SOAP response.
*
******************************************************************************/
public class SoapException extends Exception {
private String serverResponse;
//**************************************************************************
//** Constructor
//**************************************************************************
/** Creates a new instance of SoapException. */
public SoapException(String message, String serverResponse) {
super(getErrorMessage(message, serverResponse));
this.serverResponse = serverResponse;
}
public String getServerResponse(){
return serverResponse;
}
private static String getErrorMessage(String message, String serverResponse){
org.w3c.dom.Document xml = javaxt.xml.DOM.createDocument(serverResponse);
if (xml!=null){
org.w3c.dom.Node[] faultstrings = javaxt.xml.DOM.getElementsByTagName("faultstring", xml);
if (faultstrings.length>0){
return faultstrings[0].getTextContent();
}
}
return message;
}
}