01: package org.objectweb.celtix.bus.bindings.soap;
02:
03: import javax.xml.namespace.QName;
04: import javax.xml.soap.SOAPException;
05: import javax.xml.soap.SOAPFactory;
06: import javax.xml.soap.SOAPFault;
07: import javax.xml.ws.soap.SOAPFaultException;
08:
09: public final class SOAPFaultExHelper {
10: private SOAPFaultExHelper() {
11: //Complete
12: }
13:
14: public static SOAPFaultException createSOAPFaultEx(
15: SOAPFactory soapFactory, QName faultCode, Throwable cause) {
16:
17: StringBuffer str = new StringBuffer(cause.toString());
18: str.append("\n");
19: for (StackTraceElement s : cause.getStackTrace()) {
20: str.append(s.toString());
21: str.append("\n");
22: }
23:
24: SOAPFaultException sfe = createSOAPFaultEx(soapFactory,
25: faultCode, str.toString());
26: sfe.initCause(cause);
27: return sfe;
28: }
29:
30: public static SOAPFaultException createSOAPFaultEx(
31: SOAPFactory soapFactory, QName faultCode, String message) {
32: SOAPFault sf = null;
33: try {
34: sf = soapFactory.createFault();
35: sf.setFaultCode(faultCode);
36: sf.setFaultString(message);
37: } catch (SOAPException se) {
38: se.printStackTrace();
39: }
40: return new SOAPFaultException(sf);
41: }
42:
43: }
|