private RuntimeException mapException(Exception ex) { if (ex instanceof Fault && ex.getCause() instanceof IOException) { throw new WebServiceException(ex.getMessage(), ex.getCause()); } if (getBinding() instanceof HTTPBinding) { HTTPException exception = new HTTPException(HttpURLConnection.HTTP_INTERNAL_ERROR); exception.initCause(ex); return exception; } else if (getBinding() instanceof SOAPBinding) { SOAPFault soapFault = null; try { soapFault = JaxWsClientProxy.createSoapFault((SOAPBinding)getBinding(), ex); } catch (SOAPException e) { //ignore } if (soapFault == null) { return new WebServiceException(ex); } SOAPFaultException exception = new SOAPFaultException(soapFault); exception.initCause(ex); return exception; } return new WebServiceException(ex); }
public static SOAPFaultException createSOAPFaultEx(SOAPFactory soapFactory, QName faultCode, Throwable cause) { StringBuffer str = new StringBuffer(cause.toString()); str.append("\n"); for (StackTraceElement s : cause.getStackTrace()) { str.append(s.toString()); str.append("\n"); } SOAPFaultException sfe = createSOAPFaultEx(soapFactory, faultCode, str.toString()); sfe.initCause(cause); return sfe; }
private RuntimeException mapException(Exception ex) { if (ex instanceof Fault && ex.getCause() instanceof IOException) { throw new WebServiceException(ex.getMessage(), ex.getCause()); } if (getBinding() instanceof HTTPBinding) { HTTPException exception = new HTTPException(HttpURLConnection.HTTP_INTERNAL_ERROR); exception.initCause(ex); return exception; } else if (getBinding() instanceof SOAPBinding) { SOAPFault soapFault = null; try { soapFault = JaxWsClientProxy.createSoapFault((SOAPBinding)getBinding(), ex); } catch (SOAPException e) { //ignore } if (soapFault == null) { return new WebServiceException(ex); } SOAPFaultException exception = new SOAPFaultException(soapFault); exception.initCause(ex); return exception; } return new WebServiceException(ex); }