示例#1
0
  protected Throwable getProtocolException() {
    try {
      SOAPFault fault = SOAPVersion.SOAP_12.getSOAPFactory().createFault();
      ;
      if (reason != null) {
        for (TextType tt : reason.texts()) {
          fault.setFaultString(tt.getText());
        }
      }

      if (code != null) {
        fault.setFaultCode(code.getValue());
        fillFaultSubCodes(fault, code.getSubcode());
      }

      if (detail != null && detail.getDetail(0) != null) {
        javax.xml.soap.Detail detail = fault.addDetail();
        for (Node obj : this.detail.getDetails()) {
          Node n = fault.getOwnerDocument().importNode(obj, true);
          detail.appendChild(n);
        }
      }

      if (node != null) {
        fault.setFaultNode(node);
      }

      return new ServerSOAPFaultException(fault);
    } catch (SOAPException e) {
      throw new WebServiceException(e);
    }
  }
示例#2
0
 SOAP12Fault(CodeType code, ReasonType reason, String node, String role, Element detailObject) {
   this.code = code;
   this.reason = reason;
   this.node = node;
   this.role = role;
   if (detailObject != null) {
     if (detailObject.getNamespaceURI().equals(ns)
         && detailObject.getLocalName().equals("Detail")) {
       detail = new DetailType();
       for (Element detailEntry : DOMUtil.getChildElements(detailObject)) {
         detail.getDetails().add(detailEntry);
       }
     } else {
       detail = new DetailType(detailObject);
     }
   }
 }
示例#3
0
  SOAP12Fault(SOAPFault fault) {
    code = new CodeType(fault.getFaultCodeAsQName());
    try {
      fillFaultSubCodes(fault);
    } catch (SOAPException e) {
      throw new WebServiceException(e);
    }

    reason = new ReasonType(fault.getFaultString());
    role = fault.getFaultRole();
    node = fault.getFaultNode();
    if (fault.getDetail() != null) {
      detail = new DetailType();
      Iterator iter = fault.getDetail().getDetailEntries();
      while (iter.hasNext()) {
        Element fd = (Element) iter.next();
        detail.getDetails().add(fd);
      }
    }
  }