本文整理汇总了Java中org.apache.axis2.context.OperationContext类的典型用法代码示例。如果您正苦于以下问题:Java OperationContext类的具体用法?Java OperationContext怎么用?Java OperationContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OperationContext类属于org.apache.axis2.context包,在下文中一共展示了OperationContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: gzipCompressionInsideOutSequenceTest
import org.apache.axis2.context.OperationContext; //导入依赖的package包/类
@Test(groups = {"wso2.esb"}, description = "having 'Content-Encoding = gzip' within outsequence")
public void gzipCompressionInsideOutSequenceTest() throws Exception {
ServiceClient client = getServiceClient(getProxyServiceURLHttp("sendingGZIPCompressedPayloadToClient"));
client.getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.MC_ACCEPT_GZIP, true);
OMElement response = client.sendReceive(Utils.getStockQuoteRequest("GZIP"));
OperationContext operationContext = client.getLastOperationContext();
MessageContext inMessageContext = operationContext.getMessageContext(WSDL2Constants.MESSAGE_LABEL_IN);
CommonsTransportHeaders transportHeaders = (CommonsTransportHeaders) inMessageContext.getProperty(TRANSPORT_HEADERS);
Assert.assertTrue(transportHeaders.containsKey(CONTENT_ENCODING), "Response Message not encoded");
Assert.assertEquals(transportHeaders.get(CONTENT_ENCODING), "gzip", "Response Message not gzip encoded");
Assert.assertTrue(response.toString().contains("GZIP"));
Assert.assertTrue(response.toString().contains("GZIP Company"));
}
开发者ID:wso2,项目名称:product-ei,代码行数:15,代码来源:ESBJAVA2262ContentEncodingGzipTestCase.java
示例2: getInHeader
import org.apache.axis2.context.OperationContext; //导入依赖的package包/类
public OMElement getInHeader() throws XdsInternalException {
OperationContext oc = serviceClient.getLastOperationContext();
HashMap<String, MessageContext> ocs = oc.getMessageContexts();
MessageContext in = ocs.get("In");
if (in == null)
return null;
if (in.getEnvelope() == null)
return null;
if (in.getEnvelope().getHeader() == null)
return null;
return Util.deep_copy( in.getEnvelope().getHeader());
}
开发者ID:jembi,项目名称:openxds,代码行数:17,代码来源:Soap.java
示例3: createResponseMessageContext
import org.apache.axis2.context.OperationContext; //导入依赖的package包/类
/**
* Creates the {@link MessageContext} for the response to message currently being processed.
*
* @param reqContext The MessageContext of the received message
* @return The MessageContext for the response message
*/
public static MessageContext createResponseMessageContext(final MessageContext reqContext) {
try {
MessageContext resCtx = null;
// First try to get the context for the response from the OperationContext
final OperationContext opContext = reqContext.getOperationContext();
if (opContext != null) {
resCtx = opContext.getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
}
// If that fails, construct a new context
if (resCtx == null) {
resCtx = MessageContextBuilder.createOutMessageContext(reqContext);
resCtx.getOperationContext().addMessageContext(resCtx);
}
return resCtx;
} catch (final AxisFault af) {
// Somewhere the construction of the new MessageContext failed
return null;
}
}
开发者ID:holodeck-b2b,项目名称:Holodeck-B2B,代码行数:30,代码来源:Axis2Utils.java
示例4: getPropertyFromMsgCtx
import org.apache.axis2.context.OperationContext; //导入依赖的package包/类
/**
* Helper method to retrieve a property from a specific message context of the operation the given message context
* is part of.
*
* @param currentMsgCtx The current {@link MessageContext}
* @param key The name of the property to get the value for
* @param flow The flow from which the property should be retrieved as integer represented using the
* {@link MessageContext#IN_FLOW} and {@link MessageContext#OUT_FLOW} constants
* @return The value of the requested property if it exists in the out flow message context,or <br>
* <code>null</code> otherwise.
*/
private static Object getPropertyFromMsgCtx(final MessageContext currentMsgCtx, final String key,
final int flow) {
if (currentMsgCtx == null || key == null)
return null;
try {
final OperationContext opContext = currentMsgCtx.getOperationContext();
final MessageContext targetMsgContext = opContext.getMessageContext(flow == MessageContext.IN_FLOW ?
WSDLConstants.MESSAGE_LABEL_IN_VALUE :
WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
return targetMsgContext.getProperty(key);
} catch (final Exception ex) {
return null;
}
}
开发者ID:holodeck-b2b,项目名称:Holodeck-B2B,代码行数:28,代码来源:MessageContextUtils.java
示例5: showMCTable
import org.apache.axis2.context.OperationContext; //导入依赖的package包/类
private void showMCTable(OperationContext oc) {
if (oc == null) {
return;
}
HashMap mcTable = oc.getMessageContexts();
if ((mcTable == null) || (mcTable.isEmpty())) {
return;
}
Iterator it = mcTable.keySet().iterator();
while (it.hasNext()) {
String key = (String) it.next();
MessageContext mc = (MessageContext) mcTable.get(key);
if (mc != null) {
String id = mc.getMessageID();
log.debug("message context table entry: label [" + key +
"] message ID [" + id + "] ");
}
}
}
开发者ID:wso2,项目名称:wso2-axis2,代码行数:26,代码来源:MessageContextSaveCTest.java
示例6: invoke
import org.apache.axis2.context.OperationContext; //导入依赖的package包/类
public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
String title = "TempHandler[" + getHandlerID() + "]:invoke(): ";
// get the service context from the message context
ServiceContext serviceContext = msgContext.getServiceContext();
if (serviceContext == null) {
// get the service context from the operation context
OperationContext operationContext = msgContext.getOperationContext();
serviceContext = operationContext.getServiceContext();
}
if (serviceContext != null) {
for (int j = 0; j < numberProperties; j++) {
count++;
String key = new String(propertyKey + ".ID[" + getHandlerID() + "]." + count);
String value = new String(propertyValue + "[" + count + "]");
serviceContext.setProperty(key, value);
}
}
log.debug(title + "executedHandlers.add(" + handlerID + ")");
executedHandlers.add(handlerID);
return InvocationResponse.CONTINUE;
}
开发者ID:wso2,项目名称:wso2-axis2,代码行数:27,代码来源:MessageContextSaveCTest.java
示例7: getServiceProperties
import org.apache.axis2.context.OperationContext; //导入依赖的package包/类
private Map getServiceProperties(MessageContext mc) {
Map properties = null;
// get the service context from the message context
ServiceContext serviceContext = mc.getServiceContext();
if (serviceContext == null) {
// get the service context from the operation context
OperationContext operationContext = mc.getOperationContext();
serviceContext = operationContext.getServiceContext();
}
if (serviceContext != null) {
properties = serviceContext.getProperties();
}
return properties;
}
开发者ID:wso2,项目名称:wso2-axis2,代码行数:19,代码来源:MessageContextSaveBTest.java
示例8: addServiceProperties
import org.apache.axis2.context.OperationContext; //导入依赖的package包/类
private void addServiceProperties(MessageContext mc, String suffix) {
// get the service context from the message context
ServiceContext serviceContext = mc.getServiceContext();
if (serviceContext == null) {
// get the service context from the operation context
OperationContext operationContext = mc.getOperationContext();
serviceContext = operationContext.getServiceContext();
}
if (serviceContext != null) {
for (int k = 0; k < serviceKeys.length; k++) {
String key = serviceKeys[k];
String value = serviceValues[k] + suffix;
serviceContext.setProperty(key, value);
}
}
}
开发者ID:wso2,项目名称:wso2-axis2,代码行数:20,代码来源:MessageContextSaveBTest.java
示例9: getRelatedMessageContext
import org.apache.axis2.context.OperationContext; //导入依赖的package包/类
/**
* getRelatedMessageContext
* @param mc Axis2 MessageContext
* @return related MessageContext
*/
private static org.apache.axis2.context.MessageContext
getRelatedMessageContext(org.apache.axis2.context.MessageContext mc) {
if (log.isDebugEnabled()) {
log.debug("Enter getRelatedMessageContext for:" + mc);
}
org.apache.axis2.context.MessageContext relatedMC = null;
if (mc != null) {
OperationContext oc = mc.getOperationContext();
if (oc != null) {
try {
relatedMC = oc.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
if (relatedMC == mc) {
relatedMC = oc.getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
}
} catch (AxisFault e) {
// TODO This should never occur in this scenario, swallow and continue
}
}
}
if (log.isDebugEnabled()) {
log.debug("Exit getRelatedMessageContext related messageContext is" + relatedMC);
}
return relatedMC;
}
开发者ID:wso2,项目名称:wso2-axis2,代码行数:30,代码来源:ContextUtils.java
示例10: getRelatedMessageContext
import org.apache.axis2.context.OperationContext; //导入依赖的package包/类
/**
* @param mc
* @return
*/
private static MessageContext getRelatedMessageContext(MessageContext mc) {
if (log.isDebugEnabled()) {
log.debug("Enter getRelatedMessageContext for:" + mc);
}
MessageContext relatedMC = null;
if (mc != null) {
OperationContext oc = mc.getOperationContext();
if (oc != null) {
try {
relatedMC = oc.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
if (relatedMC == mc) {
relatedMC = oc.getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
}
} catch (AxisFault e) {
// TODO This should never occur in this scenario, swallow and continue
}
}
}
if (log.isDebugEnabled()) {
log.debug("Exit getRelatedMessageContext related messageContext is" + relatedMC);
}
return relatedMC;
}
开发者ID:wso2,项目名称:wso2-axis2,代码行数:28,代码来源:HandlerUtils.java
示例11: findOperation
import org.apache.axis2.context.OperationContext; //导入依赖的package包/类
public AxisOperation findOperation(AxisService service, MessageContext messageContext)
throws AxisFault {
RelatesTo relatesTo = messageContext.getRelatesTo();
if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
log.debug(messageContext.getLogIDString() +
" Checking for OperationContext using RelatesTo : " + relatesTo);
}
if ((relatesTo != null) && (relatesTo.getValue() != null)) {
ConfigurationContext configurationContext = messageContext.getConfigurationContext();
OperationContext operationContext =
configurationContext.getOperationContext(relatesTo.getValue());
if (operationContext != null) {
if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
log.debug(messageContext.getLogIDString() + " Found OperationContext: " +
operationContext);
}
return operationContext.getAxisOperation();
}
}
return null;
}
开发者ID:wso2,项目名称:wso2-axis2,代码行数:22,代码来源:RelatesToBasedOperationDispatcher.java
示例12: findService
import org.apache.axis2.context.OperationContext; //导入依赖的package包/类
public AxisService findService(MessageContext messageContext) throws AxisFault {
RelatesTo relatesTo = messageContext.getRelatesTo();
if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
log.debug(messageContext.getLogIDString() +
" Checking for OperationContext using RelatesTo : " + relatesTo);
}
if ((relatesTo != null) && (relatesTo.getValue() != null)) {
ConfigurationContext configurationContext = messageContext.getConfigurationContext();
OperationContext operationContext =
configurationContext.getOperationContext(relatesTo.getValue());
if (operationContext != null) {
if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
log.debug(messageContext.getLogIDString() + " Found OperationContext: " +
operationContext);
}
return operationContext.getServiceContext().getAxisService();
}
}
return null;
}
开发者ID:wso2,项目名称:wso2-axis2,代码行数:21,代码来源:RelatesToBasedServiceDispatcher.java
示例13: getUnderstoodClientHeaders
import org.apache.axis2.context.OperationContext; //导入依赖的package包/类
/**
* Get the collection of Header QNames that are registered as being understood.
* This assumes that a Set of QNames which indicates what headers are "understood" by
* this particular client through the client's programming model (i.e. application
* handlers) has been defined and stored on the outbound MessageContext under the
* client.UnderstoodHeaders property.
* @param msgContext The inbound message context
* @return a Set of Header QNames that have been registered as understood, or null if
* none have been registered.
*/
private static Set getUnderstoodClientHeaders(MessageContext msgContext) {
Set returnQN = null;
// The client sets the property on the JAX-WS Request Message Context, which will be copied
// to the Axis2 outbound message context.
OperationContext opCtx = msgContext.getOperationContext();
MessageContext outboundMC = null;
try {
outboundMC = opCtx.getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
}
catch (AxisFault af) {
// Ignore this; it means that there wasn't an outbound message for this operation.
}
if (outboundMC != null) {
returnQN =
(Set) outboundMC.getProperty("client.UnderstoodHeaders");
}
return returnQN;
}
开发者ID:wso2,项目名称:wso2-axis2,代码行数:29,代码来源:AxisEngine.java
示例14: getCharSetEncoding
import org.apache.axis2.context.OperationContext; //导入依赖的package包/类
/**
* Utility method to query CharSetEncoding. First look in the
* MessageContext. If it's not there look in the OpContext. Use the defualt,
* if it's not given in either contexts.
*
* @param msgContext the active MessageContext
* @return String the CharSetEncoding
*/
public static String getCharSetEncoding(MessageContext msgContext) {
String charSetEnc = (String) msgContext
.getProperty(Constants.Configuration.CHARACTER_SET_ENCODING);
if (charSetEnc == null) {
OperationContext opctx = msgContext.getOperationContext();
if (opctx != null) {
charSetEnc = (String) opctx
.getProperty(Constants.Configuration.CHARACTER_SET_ENCODING);
}
/**
* If the char set enc is still not found use the default
*/
if (charSetEnc == null) {
charSetEnc = MessageContext.DEFAULT_CHAR_SET_ENCODING;
}
}
return charSetEnc;
}
开发者ID:wso2,项目名称:wso2-axis2,代码行数:28,代码来源:TransportUtils.java
示例15: addMessageContext
import org.apache.axis2.context.OperationContext; //导入依赖的package包/类
public void addMessageContext(MessageContext msgContext,
OperationContext opContext) throws AxisFault {
HashMap<String, MessageContext> mep = opContext.getMessageContexts();
MessageContext immsgContext = (MessageContext) mep
.get(MESSAGE_LABEL_IN_VALUE);
MessageContext outmsgContext = (MessageContext) mep
.get(MESSAGE_LABEL_OUT_VALUE);
if ((immsgContext != null) && (outmsgContext != null)) {
throw new AxisFault(Messages.getMessage("mepcompleted"));
}
if (outmsgContext == null) {
mep.put(MESSAGE_LABEL_OUT_VALUE, msgContext);
} else {
mep.put(MESSAGE_LABEL_IN_VALUE, msgContext);
opContext.setComplete(true);
opContext.cleanup();
}
}
开发者ID:wso2,项目名称:wso2-axis2,代码行数:21,代码来源:OutInAxisOperation.java
示例16: addMessageContext
import org.apache.axis2.context.OperationContext; //导入依赖的package包/类
public void addMessageContext(MessageContext msgContext, OperationContext opContext)
throws AxisFault {
HashMap mep = opContext.getMessageContexts();
MessageContext inMsgContext = (MessageContext) mep.get(MESSAGE_LABEL_IN_VALUE);
MessageContext outmsgContext = (MessageContext) mep.get(MESSAGE_LABEL_OUT_VALUE);
if ((inMsgContext != null) && (outmsgContext != null)) {
throw new AxisFault(Messages.getMessage("mepcompleted"));
}
if (inMsgContext == null) {
mep.put(MESSAGE_LABEL_IN_VALUE, msgContext);
} else {
mep.put(MESSAGE_LABEL_OUT_VALUE, msgContext);
opContext.setComplete(true);
opContext.cleanup();
}
}
开发者ID:wso2,项目名称:wso2-axis2,代码行数:19,代码来源:InOutAxisOperation.java
示例17: createSynapseMessageContext
import org.apache.axis2.context.OperationContext; //导入依赖的package包/类
private MessageContext createSynapseMessageContext() throws AxisFault {
org.apache.axis2.context.MessageContext axis2MC = new org.apache.axis2.context.MessageContext();
axis2MC.setConfigurationContext(this.configContext);
ServiceContext svcCtx = new ServiceContext();
OperationContext opCtx = new OperationContext(new InOutAxisOperation(), svcCtx);
axis2MC.setServiceContext(svcCtx);
axis2MC.setOperationContext(opCtx);
Axis2MessageContext mc = new Axis2MessageContext(axis2MC, this.synapseConfig, null);
mc.setMessageID(UIDGenerator.generateURNString());
mc.setEnvelope(OMAbstractFactory.getSOAP12Factory().createSOAPEnvelope());
mc.getEnvelope().addChild(OMAbstractFactory.getSOAP12Factory().createSOAPBody());
return mc;
}
开发者ID:wso2-extensions,项目名称:esb-connector-file,代码行数:16,代码来源:FileMoveUnitTest.java
示例18: gzipCompressionBothInAndOutSequencesTest
import org.apache.axis2.context.OperationContext; //导入依赖的package包/类
@Test(groups = {"wso2.esb"}, description = "having 'Content-Encoding = gzip' within both in and out sequences and accepting gzip response")
public void gzipCompressionBothInAndOutSequencesTest() throws Exception {
ServiceClient client = getServiceClient(getProxyServiceURLHttp("sendAndReceiveGZIPCompressedPayload"));
client.getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.MC_ACCEPT_GZIP, true);
OMElement response = client.sendReceive(Utils.getStockQuoteRequest("GZIP"));
OperationContext operationContext = client.getLastOperationContext();
MessageContext inMessageContext = operationContext.getMessageContext(WSDL2Constants.MESSAGE_LABEL_IN);
CommonsTransportHeaders transportHeaders = (CommonsTransportHeaders) inMessageContext.getProperty(TRANSPORT_HEADERS);
Assert.assertTrue(transportHeaders.containsKey(CONTENT_ENCODING), "Response Message not encoded");
Assert.assertEquals(transportHeaders.get(CONTENT_ENCODING), "gzip", "Response Message not gzip encoded");
Assert.assertTrue(response.toString().contains("GZIP"));
Assert.assertTrue(response.toString().contains("GZIP Company"));
}
开发者ID:wso2,项目名称:product-ei,代码行数:15,代码来源:ESBJAVA2262ContentEncodingGzipTestCase.java
示例19: sendingAndReceivingGzipCompressedPayloadTest
import org.apache.axis2.context.OperationContext; //导入依赖的package包/类
@Test(groups = {"wso2.esb"}, description = "having 'Accept-Encoding = gzip' within both in and out sequences")
public void sendingAndReceivingGzipCompressedPayloadTest() throws Exception {
ServiceClient client = getServiceClient(getProxyServiceURLHttp("sendingGZIPCompressedPayloadToClient"));
client.getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.MC_GZIP_REQUEST, true);
client.getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.MC_ACCEPT_GZIP, true);
OMElement response = client.sendReceive(Utils.getStockQuoteRequest("GZIP"));
OperationContext operationContext = client.getLastOperationContext();
MessageContext inMessageContext = operationContext.getMessageContext(WSDL2Constants.MESSAGE_LABEL_IN);
CommonsTransportHeaders transportHeaders = (CommonsTransportHeaders) inMessageContext.getProperty(TRANSPORT_HEADERS);
Assert.assertTrue(transportHeaders.containsKey(CONTENT_ENCODING), "Response Message not encoded");
Assert.assertEquals(transportHeaders.get(CONTENT_ENCODING), "gzip", "Response Message not gzip encoded");
Assert.assertTrue(response.toString().contains("GZIP"));
Assert.assertTrue(response.toString().contains("GZIP Company"));
}
开发者ID:wso2,项目名称:product-ei,代码行数:15,代码来源:ESBJAVA2262ContentEncodingGzipTestCase.java
示例20: sendingAndReceivingGzipCompressedRequestInAllPathTest
import org.apache.axis2.context.OperationContext; //导入依赖的package包/类
@Test(groups = {"wso2.esb"}, description = "sending and accepting gzip compressed payload")
public void sendingAndReceivingGzipCompressedRequestInAllPathTest() throws Exception {
ServiceClient client = getServiceClient(getProxyServiceURLHttp("sendAndReceiveGZIPCompressedPayload"));
client.getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.MC_GZIP_REQUEST, true);
client.getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.MC_ACCEPT_GZIP, true);
OMElement response = client.sendReceive(Utils.getStockQuoteRequest("GZIP"));
OperationContext operationContext = client.getLastOperationContext();
MessageContext inMessageContext = operationContext.getMessageContext(WSDL2Constants.MESSAGE_LABEL_IN);
CommonsTransportHeaders transportHeaders = (CommonsTransportHeaders) inMessageContext.getProperty(TRANSPORT_HEADERS);
Assert.assertTrue(transportHeaders.containsKey(CONTENT_ENCODING), "Response Message not encoded");
Assert.assertEquals(transportHeaders.get(CONTENT_ENCODING), "gzip", "Response Message not gzip encoded");
Assert.assertTrue(response.toString().contains("GZIP"));
Assert.assertTrue(response.toString().contains("GZIP Company"));
}
开发者ID:wso2,项目名称:product-ei,代码行数:15,代码来源:ESBJAVA2262ContentEncodingGzipTestCase.java
注:本文中的org.apache.axis2.context.OperationContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论