Example usage for javax.xml.soap Detail getFirstChild

List of usage examples for javax.xml.soap Detail getFirstChild

Introduction

In this page you can find the example usage for javax.xml.soap Detail getFirstChild.

Prototype

public Node getFirstChild();

Source Link

Document

The first child of this node.

Usage

From source file:org.uddi.v2_service.DispositionReport.java

/** 
 * Convenience method to figure out if the Exception at hand contains a
 * DispositionReport. Disposition report will be null if none can be found.
 * /*from   w w w.jav a 2 s  .com*/
 * @param e the Exception at hang
 * @return DispositionReport if one can be found, or null if it is not.
 */
public static org.uddi.api_v2.DispositionReport getDispositionReport(Exception e) {
    org.uddi.api_v2.DispositionReport report = null;
    if (e instanceof DispositionReport) {
        DispositionReport faultMsg = (DispositionReport) e;
        report = faultMsg.faultInfo;
    } else if (e instanceof SOAPFaultException) {
        SOAPFaultException soapFault = (SOAPFaultException) e;
        Detail detail = soapFault.getFault().getDetail();
        if (detail != null && detail.getFirstChild() != null) {
            try {
                report = new org.uddi.api_v2.DispositionReport(detail.getFirstChild());
            } catch (JAXBException je) {
                log.error("Could not unmarshall detail to a DispositionReport");
            }
        }
    } else if (e instanceof UndeclaredThrowableException) {
        UndeclaredThrowableException ute = (UndeclaredThrowableException) e;
        if (ute.getUndeclaredThrowable() != null && ute.getUndeclaredThrowable().getCause() != null
                && ute.getUndeclaredThrowable().getCause().getCause() instanceof DispositionReport) {
            DispositionReport faultMsg = (DispositionReport) ute.getUndeclaredThrowable().getCause().getCause();
            report = faultMsg.getFaultInfo();
        }
    } else {
        log.error("Unsupported Exception: " + e.getClass());
    }
    return report;
}

From source file:org.uddi.v3_service.DispositionReportFaultMessage.java

/** 
 * Convenience method to figure out if the Exception at hand contains a
 * DispositionReport. Disposition report will be null if none can be found.
 * //from  w w  w . j  a  v  a2  s .c  o  m
 * @param e the Exception at hang
 * @return DispositionReport if one can be found, or null if it is not.
 */
public static DispositionReport getDispositionReport(Exception e) {
   DispositionReport report = null;
   if (e instanceof DispositionReportFaultMessage) {
      DispositionReportFaultMessage faultMsg = (DispositionReportFaultMessage) e;
      report = faultMsg.getFaultInfo();
   } else if (e instanceof SOAPFaultException) {
      SOAPFaultException soapFault = (SOAPFaultException) e;
      Detail detail = soapFault.getFault().getDetail();
      if (detail != null && detail.getFirstChild()!=null) {
         try {
            report =  new DispositionReport(detail.getFirstChild());
         } catch (JAXBException je) {
            log.error("Could not unmarshall detail to a DispositionReport");
         }
      }
   } else if (e instanceof UndeclaredThrowableException) {
      UndeclaredThrowableException ute =(UndeclaredThrowableException) e;
      if (ute.getUndeclaredThrowable()!=null && ute.getUndeclaredThrowable().getCause()!=null
          && ute.getUndeclaredThrowable().getCause().getCause() instanceof DispositionReportFaultMessage) {
         DispositionReportFaultMessage faultMsg = (DispositionReportFaultMessage) ute.getUndeclaredThrowable().getCause().getCause();
         report = faultMsg.getFaultInfo();
      }
   } else {
      log.error("Unsupported Exception: " + e.getClass());
   }
   return report;
}