本文整理汇总了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;
}
示例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;
}