当前位置: 首页>>代码示例>>Java>>正文


Java ProblemActionHeader类代码示例

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


ProblemActionHeader类属于com.sun.xml.internal.ws.message包,在下文中一共展示了ProblemActionHeader类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: create

import com.sun.xml.internal.ws.message.ProblemActionHeader; //导入依赖的package包/类
/**
 * Creates a fault {@link Message} that captures the code/subcode/subsubcode
 * defined by WS-Addressing if wsa:Action is not supported.
 *
 * @param unsupportedAction The unsupported Action. Must not be null.
 * @param av The WS-Addressing version of the message. Must not be null.
 * @param sv The SOAP Version of the message. Must not be null.
 *
 * @return
 *      A message representing SOAPFault that contains the WS-Addressing code/subcode/subsubcode.
 */
public static Message create(@NotNull String unsupportedAction, @NotNull AddressingVersion av, @NotNull SOAPVersion sv) {
    QName subcode = av.actionNotSupportedTag;
    String faultstring = String.format(av.actionNotSupportedText, unsupportedAction);

    Message faultMessage;
    SOAPFault fault;
    try {
        if (sv == SOAPVersion.SOAP_12) {
            fault = SOAPVersion.SOAP_12.getSOAPFactory().createFault();
            fault.setFaultCode(SOAPConstants.SOAP_SENDER_FAULT);
            fault.appendFaultSubcode(subcode);
            Detail detail = fault.addDetail();
            SOAPElement se = detail.addChildElement(av.problemActionTag);
            se = se.addChildElement(av.actionTag);
            se.addTextNode(unsupportedAction);
        } else {
            fault = SOAPVersion.SOAP_11.getSOAPFactory().createFault();
            fault.setFaultCode(subcode);
        }
        fault.setFaultString(faultstring);

        faultMessage = SOAPFaultBuilder.createSOAPFaultMessage(sv, fault);
        if (sv == SOAPVersion.SOAP_11) {
            faultMessage.getHeaders().add(new ProblemActionHeader(unsupportedAction, av));
        }
    } catch (SOAPException e) {
        throw new WebServiceException(e);
    }

    return faultMessage;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:43,代码来源:Messages.java

示例2: create

import com.sun.xml.internal.ws.message.ProblemActionHeader; //导入依赖的package包/类
/**
 * Creates a fault {@link Message} that captures the code/subcode/subsubcode
 * defined by WS-Addressing if wsa:Action is not supported.
 *
 * @param unsupportedAction The unsupported Action. Must not be null.
 * @param av The WS-Addressing version of the message. Must not be null.
 * @param sv The SOAP Version of the message. Must not be null.
 *
 * @return
 *      A message representing SOAPFault that contains the WS-Addressing code/subcode/subsubcode.
 */
public static Message create(@NotNull String unsupportedAction, @NotNull AddressingVersion av, @NotNull SOAPVersion sv) {
    QName subcode = av.actionNotSupportedTag;
    String faultstring = String.format(av.actionNotSupportedText, unsupportedAction);

    Message faultMessage;
    SOAPFault fault;
    try {
        if (sv == SOAPVersion.SOAP_12) {
            fault = SOAPVersion.SOAP_12.saajSoapFactory.createFault();
            fault.setFaultCode(SOAPConstants.SOAP_SENDER_FAULT);
            fault.appendFaultSubcode(subcode);
            Detail detail = fault.addDetail();
            SOAPElement se = detail.addChildElement(av.problemActionTag);
            se = se.addChildElement(av.actionTag);
            se.addTextNode(unsupportedAction);
        } else {
            fault = SOAPVersion.SOAP_11.saajSoapFactory.createFault();
            fault.setFaultCode(subcode);
        }
        fault.setFaultString(faultstring);

        faultMessage = SOAPFaultBuilder.createSOAPFaultMessage(sv, fault);
        if (sv == SOAPVersion.SOAP_11) {
            faultMessage.getHeaders().add(new ProblemActionHeader(unsupportedAction, av));
        }
    } catch (SOAPException e) {
        throw new WebServiceException(e);
    }

    return faultMessage;
}
 
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:43,代码来源:Messages.java


注:本文中的com.sun.xml.internal.ws.message.ProblemActionHeader类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。