faultActor = rex.getFaultActor(); // SOAP Fault faultActor
DispositionReport dispRpt = rex.getDispositionReport();
if (dispRpt != null)
{
Result result = null;
ErrInfo errInfo = null;
Vector results = dispRpt.getResultVector();
if ((results != null) && (!results.isEmpty()))
result = (Result) results.elementAt(0);
if (result != null)
{
errno = String.valueOf(result.getErrno()); // UDDI Result errno
errInfo = result.getErrInfo();
if (errInfo != null)
{
errCode = errInfo.getErrCode(); // UDDI ErrInfo errCode
errMsg = errInfo.getErrMsg(); // UDDI ErrInfo errMsg
}
}
}
} else
{
log.error(ex.getMessage(), ex);
faultCode = "Server";
faultString = ex.getMessage();
faultActor = null;
errno = String.valueOf(Result.E_FATAL_ERROR);
errCode = Result.lookupErrCode(Result.E_FATAL_ERROR);
errMsg = Result.lookupErrText(Result.E_FATAL_ERROR);
}
try
{
SOAPBody soapResBody = soapRes.getSOAPBody();
SOAPFault soapFault = soapResBody.addFault();
if(faultCode == null)
faultCode = "Unavailable";
soapFault.setFaultCode(faultCode);
soapFault.setFaultString(faultString);
soapFault.setFaultActor(faultActor);
Detail faultDetail = soapFault.addDetail();
SOAPElement dispRpt = faultDetail.addChildElement("dispositionReport", "", IRegistry.UDDI_V2_NAMESPACE);
dispRpt.setAttribute("generic", IRegistry.UDDI_V2_GENERIC);
dispRpt.setAttribute("operator", Config.getOperator());
SOAPElement result = dispRpt.addChildElement("result");
result.setAttribute("errno", errno);
SOAPElement errInfo = result.addChildElement("errInfo");
errInfo.setAttribute("errCode", errCode);
errInfo.setValue(errMsg);
} catch (Exception e)
{ // if we end up in here it's just NOT good.
log.error("A serious error has occured while assembling the SOAP Fault.", e);