Java Code Examples for org.apache.axis2.context.MessageContext#getAxisOperation()
The following examples show how to use
org.apache.axis2.context.MessageContext#getAxisOperation() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IntegratorStatefulHandler.java From micro-integrator with Apache License 2.0 | 6 votes |
/** * Finds axis Service and the Operation for DSS requests * * @param msgContext request message context * @throws AxisFault if any exception occurs while finding axis service or operation */ private static void dispatchAndVerify(MessageContext msgContext) throws AxisFault { requestDispatcher.invoke(msgContext); AxisService axisService = msgContext.getAxisService(); if (axisService != null) { httpLocationBasedDispatcher.invoke(msgContext); if (msgContext.getAxisOperation() == null) { requestURIOperationDispatcher.invoke(msgContext); } AxisOperation axisOperation; if ((axisOperation = msgContext.getAxisOperation()) != null) { AxisEndpoint axisEndpoint = (AxisEndpoint) msgContext.getProperty(WSDL2Constants.ENDPOINT_LOCAL_NAME); if (axisEndpoint != null) { AxisBindingOperation axisBindingOperation = (AxisBindingOperation) axisEndpoint .getBinding().getChild(axisOperation.getName()); msgContext.setProperty(Constants.AXIS_BINDING_OPERATION, axisBindingOperation); } msgContext.setAxisOperation(axisOperation); } } }
Example 2
Source File: ResponseTimeCalculator.java From carbon-commons with Apache License 2.0 | 6 votes |
private static void updateCurrentInvocationStatistic(MessageContext messageContext, long responseTime) throws AxisFault { messageContext.setProperty(StatisticsConstants.GLOBAL_CURRENT_INVOCATION_RESPONSE_TIME,responseTime); if (messageContext.getAxisOperation() != null) { Parameter operationResponseTimeParam = new Parameter(); operationResponseTimeParam.setName(StatisticsConstants.OPERATION_RESPONSE_TIME); operationResponseTimeParam.setValue(responseTime); messageContext.getAxisOperation().addParameter(operationResponseTimeParam); } if (messageContext.getAxisService() != null) { Parameter serviceResponseTimeParam = new Parameter(); serviceResponseTimeParam.setName(StatisticsConstants.SERVICE_RESPONSE_TIME); serviceResponseTimeParam.setValue(responseTime); messageContext.getAxisService().addParameter(serviceResponseTimeParam); } }
Example 3
Source File: TracingInPostDispatchHandler.java From carbon-commons with Apache License 2.0 | 5 votes |
public InvocationResponse invoke(MessageContext msgContext) throws AxisFault { AxisService axisService = msgContext.getAxisService(); if (axisService == null || axisService.isClientSide()) { return InvocationResponse.CONTINUE; } // Do not trace messages from admin services if (axisService.getParent() != null) { if (SystemFilter.isFilteredOutService(axisService.getAxisServiceGroup())) { return InvocationResponse.CONTINUE; } } ConfigurationContext configCtx = msgContext.getConfigurationContext(); TraceFilter traceFilter = (TraceFilter) configCtx.getAxisConfiguration(). getParameter(TracerConstants.TRACE_FILTER_IMPL).getValue(); if (traceFilter.isFilteredOut(msgContext)) { return InvocationResponse.CONTINUE; } if ((msgContext.getAxisOperation() != null) && (msgContext.getAxisOperation().getName() != null)) { String operationName = msgContext.getAxisOperation().getName().getLocalPart(); String serviceName = axisService.getName(); // Add the message id to the CircularBuffer. // We need to track only the IN_FLOW msg, since with that sequence number, // we can retrieve all other related messages from the persister. appendMessage(msgContext.getConfigurationContext(), serviceName, operationName, storeMessage(serviceName, operationName, msgContext)); } return InvocationResponse.CONTINUE; }
Example 4
Source File: DataServiceRequest.java From micro-integrator with Apache License 2.0 | 4 votes |
public static DataServiceRequest createDataServiceRequest( MessageContext msgContext) throws DataServiceFault { AxisService axisService = msgContext.getAxisService(); AxisOperation axisOp = msgContext.getAxisOperation(); OMElement inputMessage = msgContext.getEnvelope().getBody().getFirstElement(); /* get operation/request name */ String requestName = axisOp.getName().getLocalPart(); if (Boolean.parseBoolean(System.getProperty("dss.force.xml.validation"))) { if (inputMessage != null && !requestName.equals(inputMessage.getLocalName())) { throw new DataServiceFault("Input Message and " + requestName + " Axis Operation didn't match."); } } /* retrieve the DataService object representing the current data service */ DataService dataService = (DataService) axisService.getParameter( DBConstants.DATA_SERVICE_OBJECT).getValue(); DataServiceRequest dsRequest; /* Check whether the request is collection of requests (request box), if so create RequestBoxRequest */ if (isRequestBoxRequest(requestName)) { dsRequest = createRequestBoxRequest(dataService, requestName, inputMessage); return dsRequest; } /* check if batch or single request */ if (isBatchRequest(inputMessage)) { dsRequest = new BatchDataServiceRequest( dataService, requestName, getBatchInputValuesFromOM(inputMessage)); } else { dsRequest = new SingleDataServiceRequest( dataService, requestName, getSingleInputValuesFromOM(inputMessage)); } /* set user information */ populateUserInfo(dataService, dsRequest, msgContext); /* checks if this is a boxcarring session */ if (isBoxcarringRequest(requestName)) { /* wrap the current request in a boxcarring request */ dsRequest = new BoxcarringDataServiceRequest(dsRequest); } return dsRequest; }
Example 5
Source File: InOnlyMEPHandler.java From carbon-commons with Apache License 2.0 | 4 votes |
@Override // Handle IN_ONLY operations public void flowComplete(MessageContext msgContext) { if (msgContext.getEnvelope() == null) { return; } AxisService axisService = msgContext.getAxisService(); if (axisService == null || SystemFilter.isFilteredOutService(axisService.getAxisServiceGroup()) || axisService.isClientSide()) { return; } try { // Process Request Counter OperationContext opContext = msgContext.getOperationContext(); if (opContext != null && opContext.isComplete()) { AxisOperation axisOp = opContext.getAxisOperation(); if (axisOp != null && axisOp.isControlOperation()) { return; } if (axisOp != null) { String mep = axisOp.getMessageExchangePattern(); if (mep != null && (mep.equals(WSDL2Constants.MEP_URI_IN_ONLY) || mep.equals(WSDL2Constants.MEP_URI_ROBUST_IN_ONLY))) { // Increment operation counter final AxisOperation axisOperation = msgContext.getAxisOperation(); if (axisOperation != null) { Parameter operationParameter = axisOperation.getParameter(StatisticsConstants.IN_OPERATION_COUNTER); if (operationParameter != null) { ((AtomicInteger) operationParameter.getValue()).incrementAndGet(); } else { log.error(StatisticsConstants.IN_OPERATION_COUNTER + " has not been set for operation " + axisService.getName() + "." + axisOperation.getName()); return; } // Calculate response times try { ResponseTimeCalculator.calculateResponseTimes(msgContext); } catch (AxisFault axisFault) { log.error("Cannot compute response times", axisFault); } } // Increment global counter Parameter globalRequestCounter = msgContext.getParameter(StatisticsConstants.GLOBAL_REQUEST_COUNTER); ((AtomicInteger) globalRequestCounter.getValue()).incrementAndGet(); updateCurrentInvocationGlobalStatistics(msgContext); } } } } catch (Throwable e) { // Catching Throwable since exceptions here should not be propagated up log.error("Could not call InOnlyMEPHandler.flowComplete", e); } }
Example 6
Source File: InOutMEPHandler.java From carbon-commons with Apache License 2.0 | 4 votes |
public InvocationResponse invoke(MessageContext outMsgContext) throws AxisFault { if(outMsgContext.getEnvelope() == null){ return InvocationResponse.CONTINUE; } if (outMsgContext.getFLOW() != MessageContext.OUT_FLOW && outMsgContext.getFLOW() != MessageContext.OUT_FAULT_FLOW) { log.error("InOutMEPHandler not deployed in OUT/OUT_FAULT flow. Flow: " + outMsgContext.getFLOW()); return InvocationResponse.CONTINUE; } try { AxisService axisService = outMsgContext.getAxisService(); if(axisService == null) { updateStatistics(outMsgContext); return InvocationResponse.CONTINUE; } else if (SystemFilter.isFilteredOutService(axisService.getAxisServiceGroup()) || axisService.isClientSide()) { return InvocationResponse.CONTINUE; } final AxisOperation axisOperation = outMsgContext.getAxisOperation(); if(axisOperation != null && axisOperation.isControlOperation()){ return InvocationResponse.CONTINUE; } if (axisOperation != null) { String mep = axisOperation.getMessageExchangePattern(); if (mep != null && (mep.equals(WSDL2Constants.MEP_URI_OUT_IN) || mep.equals(WSDL2Constants.MEP_URI_OUT_ONLY) || mep.equals(WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN))) { // If this ConfigurationContext is used for sending messages out, do not change the stats return InvocationResponse.CONTINUE; } // Process operation request count Parameter inOpCounter = axisOperation.getParameter(StatisticsConstants.IN_OPERATION_COUNTER); if (inOpCounter != null) { ((AtomicInteger) inOpCounter.getValue()).incrementAndGet(); } else { log.error(StatisticsConstants.IN_OPERATION_COUNTER + " has not been set for operation " + axisService.getName() + "." + axisOperation.getName()); return InvocationResponse.CONTINUE; } // Process operation response count Parameter outOpCounter = axisOperation.getParameter(StatisticsConstants.OUT_OPERATION_COUNTER); if (outOpCounter != null) { ((AtomicInteger) outOpCounter.getValue()).incrementAndGet(); } else { log.error(StatisticsConstants.OUT_OPERATION_COUNTER + " has not been set for operation " + axisService.getName() + "." + axisOperation.getName()); return InvocationResponse.CONTINUE; } } updateStatistics(outMsgContext); } catch (Throwable e) { log.error("Could not call InOutMEPHandler.invoke", e); } return InvocationResponse.CONTINUE; }