• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java SOAPFaultSubCode类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中org.apache.axiom.soap.SOAPFaultSubCode的典型用法代码示例。如果您正苦于以下问题:Java SOAPFaultSubCode类的具体用法?Java SOAPFaultSubCode怎么用?Java SOAPFaultSubCode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

SOAPFaultSubCode类属于org.apache.axiom.soap包,在下文中一共展示了SOAPFaultSubCode类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createTfsExceptionFromAxisFault

点赞 2

import org.apache.axiom.soap.SOAPFaultSubCode; //导入依赖的package包/类
@Nullable
private static TfsException createTfsExceptionFromAxisFault(AxisFault axisFault) {
  TfsException result = createTfsExceptionFromThrowable(axisFault.getCause());
  if (result != null) {
    return result;
  }

  SOAPFaultCode code = axisFault.getFaultCodeElement();
  if (code != null) {
    SOAPFaultSubCode subCode = code.getSubCode();
    if (subCode != null) {
      SOAPFaultValue subcodeValue = subCode.getValue();
      if (subcodeValue != null) {
        String subcodeText = subcodeValue.getText();
        if (subcodeText != null) {
          Class<?> exceptionClass = ourExceptionsBySubcodes.get(subcodeText);
          if (exceptionClass != null) {
            try {
              return (TfsException)exceptionClass.getConstructor(AxisFault.class).newInstance(axisFault);
            }
            catch (Exception e) {
              // skip
            }
          }
        }
      }
    }
  }

  int errorCode = getTransportErrorCode(axisFault);
  if (errorCode != -1) {
    return createHttpTransportErrorException(errorCode, axisFault);
  }
  return new UnknownException(axisFault);
}
 

开发者ID:Microsoft,
项目名称:vso-intellij,
代码行数:36,
代码来源:TfsExceptionManager.java

示例2: appendFaultSubcode

点赞 2

import org.apache.axiom.soap.SOAPFaultSubCode; //导入依赖的package包/类
/**
 * Adds a Subcode to the end of the sequence of Subcodes contained by this SOAPFault. Subcodes,
 * which were introduced in SOAP 1.2, are represented by a recursive sequence of subelements
 * rooted in the mandatory Code subelement of a SOAP Fault.
 *
 * @param subcode - a QName containing the Value of the Subcode.
 * @throws SOAPException - if there was an error in setting the Subcode java.lang.UnsupportedOperationException
 *                       - if this message does not support the SOAP 1.2 concept of Subcode.
 */

public void appendFaultSubcode(QName subcode) throws SOAPException {
    org.apache.axiom.soap.SOAPFactory soapFactory = null;
    SOAPFaultSubCode soapFaultSubCode = null;

    if (subcode.getNamespaceURI() == null || subcode.getNamespaceURI().trim().length() == 0) {
        throw new SOAPException("Unqualified QName object : " + subcode);
    }
    if (this.element.getOMFactory() instanceof SOAP11Factory) {
        throw new UnsupportedOperationException();
    } else if (this.element.getOMFactory() instanceof SOAP12Factory) {
        soapFactory = DOOMAbstractFactory.getSOAP12Factory();
    }

    if (this.fault.getCode() == null) {
        soapFactory.createSOAPFaultCode(this.fault);
        //if SOAPFault is null, there cannot be a subcode.
        //Hence should create one
        soapFaultSubCode = soapFactory.createSOAPFaultSubCode(this.fault.getCode());
    } else if (this.fault.getCode().getSubCode() != null) {
        //find the last subcode.parent of the new subcode should be the this last subcode
        soapFaultSubCode = soapFactory.createSOAPFaultSubCode(
                getLastSubCode(this.fault.getCode().getSubCode()));
    } else {
        //FaultCode is there, but no FaultSubCode
        soapFaultSubCode = soapFactory.createSOAPFaultSubCode(this.fault.getCode());
    }


    if (soapFaultSubCode != null) {
        SOAPFaultValueImpl soapFaultValueimpl =
                new SOAP12FaultValueImpl(soapFaultSubCode, soapFactory);
        soapFaultValueimpl.setText(subcode.getPrefix() + ":" + subcode.getLocalPart());
        soapFaultValueimpl.declareNamespace(subcode.getNamespaceURI(), subcode.getPrefix());
    }
}
 

开发者ID:wso2,
项目名称:wso2-axis2,
代码行数:46,
代码来源:SOAPFaultImpl.java

示例3: getLastSubCode

点赞 2

import org.apache.axiom.soap.SOAPFaultSubCode; //导入依赖的package包/类
private SOAPFaultSubCode getLastSubCode(SOAPFaultSubCode firstSubCodeElement) {
    SOAPFaultSubCode soapFaultSubCode = firstSubCodeElement.getSubCode();
    if (soapFaultSubCode != null) {
        return getLastSubCode(soapFaultSubCode);
    }
    return firstSubCodeElement;
}
 

开发者ID:wso2,
项目名称:wso2-axis2,
代码行数:8,
代码来源:SOAPFaultImpl.java

示例4: getFaultSubcodes

点赞 2

import org.apache.axiom.soap.SOAPFaultSubCode; //导入依赖的package包/类
/**
 * Gets the Subcodes for this SOAPFault as an iterator over QNames.
 *
 * @return an Iterator that accesses a sequence of QNames. This Iterator should not support the
 *         optional remove method. The order in which the Subcodes are returned reflects the
 *         hierarchy of Subcodes present in the fault from top to bottom.
 * @throws UnsupportedOperationException
 *          - if this message does not support the SOAP 1.2 concept of Subcode.
 */
public Iterator getFaultSubcodes() {
    if (this.element.getOMFactory() instanceof SOAP11Factory) {
        throw new UnsupportedOperationException();
    }
    ArrayList faultSubcodes = new ArrayList();
    SOAPFaultSubCode subCodeElement = this.fault.getCode().getSubCode();
    while (subCodeElement != null) {
        QName qname = subCodeElement.getValue().getTextAsQName();
        faultSubcodes.add(qname);
        subCodeElement = subCodeElement.getSubCode();
    }
    return faultSubcodes.iterator();
}
 

开发者ID:wso2,
项目名称:wso2-axis2,
代码行数:23,
代码来源:SOAPFaultImpl.java

示例5: initializeValues

点赞 2

import org.apache.axiom.soap.SOAPFaultSubCode; //导入依赖的package包/类
private void initializeValues(SOAPFaultCode soapFaultCode,
                                  SOAPFaultReason soapFaultReason,
                                  SOAPFaultNode soapFaultNode,
                                  SOAPFaultRole soapFaultRole,
                                  SOAPFaultDetail soapFaultDetail) {
        this.soapFaultCode = soapFaultCode;
        this.soapFaultReason = soapFaultReason;
        this.soapFaultNode = soapFaultNode;
        this.soapFaultRole = soapFaultRole;
        this.soapFaultDetail = soapFaultDetail;

        if (soapFaultDetail != null) {
//            OMElement exceptionElement = soapFaultDetail.getFirstChildWithName(
//                    new QName(SOAPConstants.SOAP_FAULT_DETAIL_EXCEPTION_ENTRY));
//            if (exceptionElement != null && exceptionElement.getText() != null) {
//                cause = new Exception(exceptionElement.getText());
//            }

            // TODO - Wha? Details can have multiple elements, why take the first child here?
            // TODO - Review the API for details
            // setting the first child element of the fault detail as this.detail
            this.detail = soapFaultDetail.getFirstElement();

        }

        if (soapFaultReason != null) {
            message = soapFaultReason.getText();
        }

        if (soapFaultCode != null) {
            // This works the same regardless of SOAP version
            faultCode = soapFaultCode.getTextAsQName();

            SOAPFaultSubCode subCode = soapFaultCode.getSubCode();
            if (subCode != null) {
                faultSubCodes = new ArrayList();
                while (subCode != null) {
                    faultSubCodes.add(subCode.getValue().getTextAsQName());
                    subCode = subCode.getSubCode();
                }
            }
        }
    }
 

开发者ID:wso2,
项目名称:wso2-axis2,
代码行数:44,
代码来源:AxisFault.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)