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
40
41
42
43
44
45
46
| public void printSOAPException(SOAPException x)
{
Throwable cause = x.getCause();
if(cause != null && cause instanceof AxisFault)
printAxisFault((AxisFault)cause);
else if(cause != null)
System.out.println(x.getClass().getName()
+ " exception chained: "
+ x.getMessage());
else
System.out.println("SOAP exception: " + x.getMessage());
}
public void printAxisFault(AxisFault x)
{
// tested with Axis 1.1 & Axis 1.2 alpha
if(x.getFaultCode().equals(new QName("http://xml.apache.org/axis/","HTTP")))
{
Element e =
x.lookupFaultDetail(
new QName("http://xml.apache.org/axis/","HttpErrorCode"));
if(null != e)
{
e.normalize();
String httpErrorCode = e.getFirstChild().getNodeValue().trim();
if(httpErrorCode.equals("407"))
System.out.println("Proxy password incorrect");
else if(httpErrorCode.equals("502") || httpErrorCode.equals("504"))
System.out.println("Proxy cannot find the server");
else if(httpErrorCode.equals("500"))
System.out.println("Proxy or server unavailable");
else if(httpErrorCode.equals("404"))
System.out.println("No Web service (404 File Not Found)");
else
System.out.println(x.getFaultString());
}
else
System.out.println("Network error: " + x.getFaultString());
}
else if(x.getFaultCode().equals(
new QName("http://schemas.xmlsoap.org/soap/envelope/",
"Server.userException")))
System.out.println("Most likely a net error: " + x.getFaultString());
else
System.out.println("SOAP Fault: " + x.getFaultCode() + ", "
+ x.getFaultString());
}
|