本文整理了Java中org.apache.axis2.context.MessageContext.isSOAP11()
方法的一些代码示例,展示了MessageContext.isSOAP11()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MessageContext.isSOAP11()
方法的具体详情如下:
包路径:org.apache.axis2.context.MessageContext
类名称:MessageContext
方法名:isSOAP11
暂无
代码示例来源:origin: org.apache.synapse/synapse-core
public boolean isSOAP11() {
return axis2MessageContext.isSOAP11();
}
代码示例来源:origin: wso2/wso2-synapse
public boolean isSOAP11() {
return axis2MessageContext.isSOAP11();
}
代码示例来源:origin: org.apache.axis2/axis2-kernel
public String formatSOAPAction(MessageContext msgCtxt, OMOutputFormat format,
String soapActionString) {
// if SOAP 1.2 we attach the soap action to the content-type
// No need to set it as a header.
if (msgCtxt.isSOAP11()) {
if ("".equals(soapActionString)) {
return "\"\"";
} else {
if (soapActionString != null
&& !soapActionString.startsWith("\"")) {
// SOAPAction string must be a quoted string
soapActionString = "\"" + soapActionString + "\"";
}
return soapActionString;
}
}
return null;
}
代码示例来源:origin: apache/axis2-java
public String formatSOAPAction(MessageContext msgCtxt, OMOutputFormat format,
String soapActionString) {
// if SOAP 1.2 we attach the soap action to the content-type
// No need to set it as a header.
if (msgCtxt.isSOAP11()) {
if ("".equals(soapActionString)) {
return "\"\"";
} else {
if (soapActionString != null
&& !soapActionString.startsWith("\"")) {
// SOAPAction string must be a quoted string
soapActionString = "\"" + soapActionString + "\"";
}
return soapActionString;
}
}
return null;
}
代码示例来源:origin: org.apache.axis2/axis2-transport-http
public String getContentTypeAsString() {
String encoding = format.getCharSetEncoding();
String contentType = format.getContentType();
if (encoding != null) {
contentType += "; charset=" + encoding;
}
// action header is not mandated in SOAP 1.2. So putting it, if available
if (!msgCtxt.isSOAP11() && (soapActionString != null)
&& !"".equals(soapActionString.trim()) && !"\"\"".equals(soapActionString.trim())) {
contentType = contentType + ";action=\"" + soapActionString + "\";";
}
return contentType;
}
代码示例来源:origin: org.wso2.carbon/org.wso2.carbon.bam.lwevent.core
public final void invokeBusinessLogic(MessageContext mc) throws AxisFault {
try {
handleEvent(mc);
} catch (WSEventException e) {
log.error("An exception occured. Unable to Process Request", e);
SOAPEnvelope soapEnvelope = BuilderUtils.genFaultResponse(
EventingConstants.WSE_FAULT_CODE_RECEIVER, "EventSourceUnableToProcess",
"An exception occured. Unable to Process Request ", "", mc.isSOAP11());
dispatchResponse(soapEnvelope, EventingConstants.WSA_FAULT, mc, true);
}
}
代码示例来源:origin: org.wso2.carbon.commons/org.wso2.carbon.event.ws
public final void invokeBusinessLogic(MessageContext mc) throws AxisFault {
try {
handleEvent(mc);
} catch (WSEventException e) {
log.error("An exception occured. Unable to Process Request", e);
SOAPEnvelope soapEnvelope = BuilderUtils.genFaultResponse(
EventingConstants.WSE_FAULT_CODE_RECEIVER, "EventSourceUnableToProcess",
"An exception occured. Unable to Process Request ", "", mc.isSOAP11());
dispatchResponse(soapEnvelope, EventingConstants.WSA_FAULT, mc, true);
}
}
代码示例来源:origin: org.wso2.carbon/org.wso2.carbon.bam.lwevent.core
public final void invokeBusinessLogic(MessageContext mc) throws AxisFault {
try {
processMessage(mc);
} catch (WSEventException e) {
log.error("An exception occured. Unable to Process Request", e);
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
String details = sw.toString();
pw.close();
SOAPEnvelope soapEnvelope = BuilderUtils.genFaultResponse(
EventingConstants.WSE_FAULT_CODE_RECEIVER, "EventSourceUnableToProcess",
e.getMessage(), details, mc.isSOAP11());
dispatchResponse(soapEnvelope, EventingConstants.WSA_FAULT, mc, true);
}
}
代码示例来源:origin: org.wso2.carbon.commons/org.wso2.carbon.event.ws
public final void invokeBusinessLogic(MessageContext mc) throws AxisFault {
try {
processMessage(mc);
} catch (WSEventException e) {
log.error("An exception occured. Unable to Process Request", e);
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
String details = sw.toString();
pw.close();
SOAPEnvelope soapEnvelope = BuilderUtils.genFaultResponse(
EventingConstants.WSE_FAULT_CODE_RECEIVER, "EventSourceUnableToProcess",
e.getMessage(), details, mc.isSOAP11());
dispatchResponse(soapEnvelope, EventingConstants.WSA_FAULT, mc, true);
}
}
代码示例来源:origin: wso2/wso2-synapse
private void build(MessageContext messageContext) {
try {
RelayUtils.buildMessage(messageContext, false);
if (messageContext.getEnvelope().getHeader() == null) {
SOAPFactory fac =
messageContext.isSOAP11() ? OMAbstractFactory.getSOAP11Factory()
: OMAbstractFactory.getSOAP12Factory();
fac.createSOAPHeader(messageContext.getEnvelope());
}
} catch (Exception e) {
log.error("Error while executing the message at relaySecurity handler", e);
}
}
代码示例来源:origin: org.apache.sandesha2/sandesha2-core
private static void addMessagePendingHeader(MessageContext returnMessage, String namespace) {
MessagePending messagePending = new MessagePending();
messagePending.setPending(true);
if (returnMessage.getEnvelope().getHeader() == null) {
int SOAPVersion = Sandesha2Constants.SOAPVersion.v1_1;
if (!returnMessage.isSOAP11())
SOAPVersion = Sandesha2Constants.SOAPVersion.v1_2;
//The header might not be there because of the persistence code if it doesn't exist we need to add one
SOAPAbstractFactory.getSOAPFactory(
SOAPVersion).createSOAPHeader(returnMessage.getEnvelope());
}
messagePending.toHeader(returnMessage.getEnvelope().getHeader());
}
代码示例来源:origin: org.wso2.xfer/wso2xfer
public static void triggerAxisFault(MessageContext msgCtx,
String faultInfoKey, String faultInfoValue, QName faultCode,
QName faultSubcode, String faultReason) throws AxisFault {
if (faultInfoKey != null) {
Map faultInfoForHeaders = (Map) msgCtx
.getProperty(Constants.FAULT_INFORMATION_FOR_HEADERS);
if (faultInfoForHeaders == null) {
faultInfoForHeaders = new HashMap();
msgCtx.setProperty(Constants.FAULT_INFORMATION_FOR_HEADERS,
faultInfoForHeaders);
}
faultInfoForHeaders.put(faultInfoKey, faultInfoValue);
}
/*
*
*/
if (!msgCtx.isSOAP11()) {
setFaultCodeForSOAP12(msgCtx, faultCode, faultSubcode);
}
OperationContext opCtx = msgCtx.getOperationContext();
opCtx.setProperty(
Constants.Configuration.SEND_STACKTRACE_DETAILS_WITH_FAULTS,
Boolean.FALSE);
throw new AxisFault(faultReason, faultSubcode);
}
代码示例来源:origin: org.apache.axis2/axis2-kernel
private static void triggerAddressingFault(MessageContext messageContext,
String faultInformationKey,
Object faultInformationValue, String faultcode,
String faultSubcode, String faultReason)
throws AxisFault {
Map<String, Object> faultInformation =
(Map<String, Object>)messageContext.getLocalProperty(Constants.FAULT_INFORMATION_FOR_HEADERS);
if (faultInformation == null) {
faultInformation = new HashMap<String, Object>();
messageContext.setProperty(Constants.FAULT_INFORMATION_FOR_HEADERS, faultInformation);
}
faultInformation.put(faultInformationKey, faultInformationValue);
if (messageContext.isSOAP11()) {
faultcode = (faultSubcode != null) ? faultSubcode : faultcode;
} else {
setFaultCode(messageContext, faultcode, faultSubcode);
}
OperationContext oc = messageContext.getOperationContext();
if (oc != null) {
oc.setProperty(Constants.Configuration.SEND_STACKTRACE_DETAILS_WITH_FAULTS, "false");
}
messageContext.setProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES,
Boolean.FALSE);
String namespace =
(String)messageContext.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
throw new AxisFault(faultReason, new QName(namespace, faultcode,
AddressingConstants.WSA_DEFAULT_PREFIX));
}
代码示例来源:origin: org.wso2.xfer/wso2xfer
public static void triggerInvalidRepresentationFault(MessageContext messageContext,
String detail) throws AxisFault {
QName faultCode = new QName(
SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI,
SOAP12Constants.FAULT_CODE_SENDER,
SOAP12Constants.SOAP_DEFAULT_NAMESPACE_PREFIX);
QName faultSubcode = new QName(WSTransferConstants.NS_URI_WXF,
WSTransferConstants.FAULT_INVALID_REPRESENTATION,
WSTransferConstants.ATTR_WXF);
if (!messageContext.isSOAP11()) {
SOAPFactory factory = OMAbstractFactory.getSOAP12Factory();
SOAPFaultDetail soapFaultDetail = factory.createSOAPFaultDetail();
OMElement faultDetailElement = factory.createOMElement(WSTransferConstants.FAULT_DATAIL, WSTransferConstants.NS_URI_WSMAN,WSTransferConstants.ATTR_WSMA);
faultDetailElement.setText(detail);
soapFaultDetail.addChild(faultDetailElement);
messageContext.setProperty(SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME, soapFaultDetail);
}
triggerAxisFault(messageContext, WSTransferConstants.INVALID_REPRESENTATION_DETAIL, detail , faultCode, faultSubcode, WSTransferConstants.FAULT_INVALID_REPRESENTATION_REASON);
}
代码示例来源:origin: org.wso2.carbon/org.wso2.carbon.bam.lwevent.core
protected void handleUnsubscribe(MessageContext mc) throws AxisFault, WSEventException {
if (!isEnabled(mc, ENABLE_UNSUBSCRIBE)) {
log.warn("Unsubscribe operation is disabled");
return;
}
try {
UnSubscribeCommandBuilder builder = new UnSubscribeCommandBuilder(mc);
Subscription subscription = builder.toSubscription(mc.getEnvelope());
if (log.isDebugEnabled()) {
log.debug("UnSubscribe response recived for Subscription ID : " +
subscription.getId());
}
LightWeightEventBroker.getInstance().unsubscribe(subscription);
if (log.isDebugEnabled()) {
log.debug("Sending UnSubscribe responce for Subscription ID : " +
subscription.getId());
}
SOAPEnvelope soapEnvelope = builder.fromSubscription(subscription);
dispatchResponse(soapEnvelope, EventingConstants.WSE_UNSUBSCRIBE_RESPONSE, mc, false);
} catch (InvalidMessageException e) {
throw new WSEventException("Invalid message ", e);
} catch (RegistryException e) {
log.debug("UnSubscription failed, sending fault repsponse");
SOAPEnvelope soapEnvelope = BuilderUtils.genFaultResponse(
EventingConstants.WSE_FAULT_CODE_RECEIVER, "EventSourceUnableToProcess",
"Unable to Unsubscribe", "", mc.isSOAP11());
dispatchResponse(soapEnvelope, EventingConstants.WSA_FAULT, mc, true);
}
}
代码示例来源:origin: org.wso2.carbon.commons/org.wso2.carbon.event.ws
protected void handleUnsubscribe(MessageContext mc) throws AxisFault, WSEventException {
if (!isEnabled(mc, ENABLE_UNSUBSCRIBE)) {
log.warn("Unsubscribe operation is disabled");
return;
}
try {
UnSubscribeCommandBuilder builder = new UnSubscribeCommandBuilder(mc);
Subscription subscription = builder.toSubscription(mc.getEnvelope());
if (log.isDebugEnabled()) {
log.debug("UnSubscribe response recived for Subscription ID : " +
subscription.getId());
}
getBrokerService().unsubscribe(subscription.getId());
if (log.isDebugEnabled()) {
log.debug("Sending UnSubscribe responce for Subscription ID : " +
subscription.getId());
}
SOAPEnvelope soapEnvelope = builder.fromSubscription(subscription);
dispatchResponse(soapEnvelope, EventingConstants.WSE_UNSUBSCRIBE_RESPONSE, mc, false);
} catch (InvalidMessageException e) {
throw new WSEventException("Invalid message ", e);
} catch (EventBrokerException e) {
log.debug("UnSubscription failed, sending fault repsponse");
SOAPEnvelope soapEnvelope = BuilderUtils.genFaultResponse(
EventingConstants.WSE_FAULT_CODE_RECEIVER, "EventSourceUnableToProcess",
"Unable to Unsubscribe", "", mc.isSOAP11());
dispatchResponse(soapEnvelope, EventingConstants.WSA_FAULT, mc, true);
}
}
代码示例来源:origin: apache/axis2-java
private void processFaultsInfoIfPresent() {
OMElement detailElement = AddressingFaultsHelper
.getDetailElementForAddressingFault(messageContext, addressingNamespaceObject);
if (detailElement != null) {
//The difference between SOAP 1.1 and SOAP 1.2 fault messages is explained in the WS-Addressing Specs.
if (isFinalAddressingNamespace && messageContext.isSOAP11()) {
// Add detail as a wsa:FaultDetail header
if (!isAddressingHeaderAlreadyAvailable(Final.FAULT_HEADER_DETAIL, false)) {
SOAPHeaderBlock faultDetail = header.addHeaderBlock(
Final.FAULT_HEADER_DETAIL, addressingNamespaceObject);
faultDetail.addChild((OMElement)factory.importInformationItem(detailElement));
}
} else if (!messageContext.isSOAP11()) {
// Add detail to the Fault in the SOAP Body
SOAPFault fault = envelope.getBody().getFault();
if (fault != null && fault.getDetail() != null) {
fault.getDetail().addDetailEntry(
(OMElement)factory.importInformationItem(detailElement));
}
}
}
}
代码示例来源:origin: org.apache.axis2/axis2-transport-base
/**
* Get the OMOutput format for the given message
* @param msgContext the axis message context
* @return the OMOutput format to be used
*/
public static OMOutputFormat getOMOutputFormat(MessageContext msgContext) {
OMOutputFormat format = new OMOutputFormat();
msgContext.setDoingMTOM(TransportUtils.doWriteMTOM(msgContext));
msgContext.setDoingSwA(TransportUtils.doWriteSwA(msgContext));
msgContext.setDoingREST(TransportUtils.isDoingREST(msgContext));
format.setSOAP11(msgContext.isSOAP11());
format.setDoOptimize(msgContext.isDoingMTOM());
format.setDoingSWA(msgContext.isDoingSwA());
format.setCharSetEncoding(TransportUtils.getCharSetEncoding(msgContext));
Object mimeBoundaryProperty = msgContext.getProperty(Constants.Configuration.MIME_BOUNDARY);
if (mimeBoundaryProperty != null) {
format.setMimeBoundary((String) mimeBoundaryProperty);
}
return format;
}
代码示例来源:origin: wso2/wso2-synapse
/**
* Retirn the OMOutputFormat to be used for the message context passed in
* @param msgContext the message context
* @return the OMOutputFormat to be used
*/
public static OMOutputFormat getOMOutputFormat(MessageContext msgContext) {
OMOutputFormat format = new OMOutputFormat();
msgContext.setDoingMTOM(TransportUtils.doWriteMTOM(msgContext));
msgContext.setDoingSwA(TransportUtils.doWriteSwA(msgContext));
msgContext.setDoingREST(TransportUtils.isDoingREST(msgContext));
format.setSOAP11(msgContext.isSOAP11());
format.setDoOptimize(msgContext.isDoingMTOM());
format.setDoingSWA(msgContext.isDoingSwA());
format.setCharSetEncoding(TransportUtils.getCharSetEncoding(msgContext));
Object mimeBoundaryProperty = msgContext.getProperty(Constants.Configuration.MIME_BOUNDARY);
if (mimeBoundaryProperty != null) {
format.setMimeBoundary((String) mimeBoundaryProperty);
}
return format;
}
代码示例来源:origin: apache/axis2-java
/**
* Get the OMOutput format for the given message
* @param msgContext the axis message context
* @return the OMOutput format to be used
*/
public static OMOutputFormat getOMOutputFormat(MessageContext msgContext) {
OMOutputFormat format = new OMOutputFormat();
msgContext.setDoingMTOM(TransportUtils.doWriteMTOM(msgContext));
msgContext.setDoingSwA(TransportUtils.doWriteSwA(msgContext));
msgContext.setDoingREST(TransportUtils.isDoingREST(msgContext));
format.setSOAP11(msgContext.isSOAP11());
format.setDoOptimize(msgContext.isDoingMTOM());
format.setDoingSWA(msgContext.isDoingSwA());
format.setCharSetEncoding(TransportUtils.getCharSetEncoding(msgContext));
Object mimeBoundaryProperty = msgContext.getProperty(Constants.Configuration.MIME_BOUNDARY);
if (mimeBoundaryProperty != null) {
format.setMimeBoundary((String) mimeBoundaryProperty);
}
return format;
}
内容来源于网络,如有侵权,请联系作者删除!