org.apache.axis2.description.AxisOperation Java Examples

The following examples show how to use org.apache.axis2.description.AxisOperation. 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: DBDeployer.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
/**
 * Creates an AxisOperation with the given data service operation object.
 * @see Operation
 * @see AxisOperation
 */
private AxisOperation createAxisOperationFromDSOperation(Operation operation,
		AxisBinding soap11Binding, AxisBinding soap12Binding,
		AxisBinding httpBinding) throws AxisFault {
	String opName = operation.getName();
	String requestName = operation.getRequestName();

	int index = opName.indexOf(":");
	if (index > -1) {
		opName = opName.substring(index + 1);
	}
	boolean hasResult = operation.getCallQuery().isHasResult()
			|| operation.isReturnRequestStatus();
	String description = operation.getDescription();
	return createAxisOperation(requestName, opName, HTTPConstants.HTTP_METHOD_POST, hasResult,
			soap11Binding, soap12Binding, httpBinding, description);
}
 
Example #2
Source File: IntegratorStatefulHandler.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
/**
 * 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 #3
Source File: InboundHttpServerWorker.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
private void doPreInjectTasks(MessageContext axis2MsgContext, Axis2MessageContext synCtx, String method) {

        if (!isRESTRequest(axis2MsgContext, method)) {
            if (request.isEntityEnclosing()) {
                processEntityEnclosingRequest(axis2MsgContext, false);
            } else {
                processNonEntityEnclosingRESTHandler(null, axis2MsgContext, false);
            }
        } else {
            AxisOperation axisOperation = synCtx.getAxis2MessageContext().getAxisOperation();
            synCtx.getAxis2MessageContext().setAxisOperation(null);
            String contentTypeHeader = request.getHeaders().get(HTTP.CONTENT_TYPE);
            SOAPEnvelope soapEnvelope = handleRESTUrlPost(contentTypeHeader);
            processNonEntityEnclosingRESTHandler(soapEnvelope, axis2MsgContext, false);
            synCtx.getAxis2MessageContext().setAxisOperation(axisOperation);

        }
    }
 
Example #4
Source File: AxisConfigAdminService.java    From carbon-commons with Apache License 2.0 5 votes vote down vote up
/**
 * @param serviceId
 * @param operationId
 * @return Axis config data for the given axis operation
 */
public AxisConfigData getOperationAxisConfigData(String serviceId,
                                                 String operationId) throws AxisFault {
    log.debug("Getting handler details for service " + serviceId +
              " operation " + operationId);
    AxisConfigData axisConfigData = new AxisConfigData();
    AxisConfiguration axisConfiguration = getAxisConfig();

    AxisService axisService = axisConfiguration.getService(serviceId);
    AxisOperation axisOperation = axisService.getOperation(new QName(operationId));

    // adding phases to axis config data object
    axisConfigData.
            setInflowPhaseOrder(getPhaseOrderData(axisConfiguration.getInFlowPhases(),
                                                  axisOperation.getRemainingPhasesInFlow(),
                                                  false));
    axisConfigData.
            setOutflowPhaseOrder(getPhaseOrderData(axisOperation.getPhasesOutFlow(),
                                                   axisConfiguration.getOutFlowPhases(),
                                                   true));
    axisConfigData.
            setInfaultflowPhaseOrder(getPhaseOrderData(axisConfiguration.getInFaultFlowPhases(),
                                                       axisOperation.getPhasesInFaultFlow(),
                                                       false));
    axisConfigData.
            setOutfaultPhaseOrder(getPhaseOrderData(axisOperation.getPhasesOutFaultFlow(),
                                                    axisConfiguration.getOutFaultFlowPhases(),
                                                    true));

    return axisConfigData;
}
 
Example #5
Source File: SystemStatisticsUtil.java    From carbon-commons with Apache License 2.0 5 votes vote down vote up
public OperationStatistics getOperationStatistics(AxisOperation axisOp) throws AxisFault {
    OperationStatistics operationStatistics = new OperationStatistics();
    operationStatistics.setAvgResponseTime(getAvgOperationResponseTime(axisOp));
    operationStatistics.setTotalFaultCount(getOperationFaultCount(axisOp));
    operationStatistics.setMaxResponseTime(getMaxOperationResponseTime(axisOp));
    operationStatistics.setMinResponseTime(getMinOperationResponseTime(axisOp));
    operationStatistics.setTotalRequestCount(getOperationRequestCount(axisOp));
    operationStatistics.setTotalResponseCount(getOperationResponseCount(axisOp));

    return operationStatistics;
}
 
Example #6
Source File: SystemStatisticsDeploymentInterceptor.java    From carbon-commons with Apache License 2.0 5 votes vote down vote up
public void serviceUpdate(AxisEvent axisEvent, AxisService axisService) {

        if (SystemFilter.isFilteredOutService(axisService.getAxisServiceGroup()) || axisService.isClientSide()) {
            return;
        }
        if (axisEvent.getEventType() == AxisEvent.SERVICE_DEPLOY) {
            for (Iterator iter = axisService.getOperations(); iter.hasNext(); ) {
                AxisOperation op = (AxisOperation) iter.next();
                setCountersAndProcessors(op);
            }
            // see ESBJAVA-2327
            if (JavaUtils.isTrueExplicitly(axisService.getParameterValue("disableOperationValidation"))) {
                AxisOperation defaultOp = (AxisOperation) axisService.getParameterValue("_default_mediate_operation_");
                if (defaultOp != null) {
                    setCountersAndProcessors(defaultOp);
                }
            }
            // Service response time processor
            Parameter responseTimeProcessor = new Parameter();
            responseTimeProcessor.setName(StatisticsConstants.SERVICE_RESPONSE_TIME_PROCESSOR);
            responseTimeProcessor.setValue(new ResponseTimeProcessor());
            try {
                axisService.addParameter(responseTimeProcessor);
            } catch (AxisFault axisFault) {
                // will not occur
            }
        }
    }
 
Example #7
Source File: AbstractXDSRawXMLINoutMessageReceiver.java    From openxds with Apache License 2.0 5 votes vote down vote up
private Method findOperation(AxisOperation op, Class implClass) {

		Method method = (Method) (op.getParameterValue("myMethod"));

		if (method != null)
			return method;

		String methodName = op.getName().getLocalPart();

		try {

			// Looking for a method of the form "OMElement method(OMElement)"

			method = implClass.getMethod(methodName,
					new Class[] { OMElement.class });

			if (method.getReturnType().equals(OMElement.class)) {
				try {
					op.addParameter("myMethod", method);
				} catch (AxisFault axisFault) {
					// Do nothing here
				}
				return method;
			}

		} catch (NoSuchMethodException e) {
			// Fault through
		}
		return null;

	}
 
Example #8
Source File: SystemStatisticsUtil.java    From carbon-commons with Apache License 2.0 5 votes vote down vote up
private long getResponseTime(AxisOperation axisOp) {
    Parameter responseTimeParameter = axisOp.getParameter(
            StatisticsConstants.OPERATION_RESPONSE_TIME);
    if (responseTimeParameter != null) {
        Object value = responseTimeParameter.getValue();
        if (value instanceof Long) {
            return (Long) value;
        }
    }
    return 0;
}
 
Example #9
Source File: SystemStatisticsUtil.java    From carbon-commons with Apache License 2.0 5 votes vote down vote up
public int getServiceRequestCount(AxisService axisService) throws AxisFault {
    int count = 0;
    for (Iterator opIter = axisService.getOperations(); opIter.hasNext();) {
        AxisOperation axisOp = (AxisOperation) opIter.next();
        Parameter parameter = axisOp.getParameter(StatisticsConstants.IN_OPERATION_COUNTER);
        if (parameter != null) {
            count += ((AtomicInteger) parameter.getValue()).get();
        }
    }
    return count;
}
 
Example #10
Source File: SystemStatisticsUtil.java    From carbon-commons with Apache License 2.0 5 votes vote down vote up
public int getServiceFaultCount(AxisService axisService) throws AxisFault {
    int count = 0;
    for (Iterator opIter = axisService.getOperations(); opIter.hasNext();) {
        AxisOperation axisOp = (AxisOperation) opIter.next();
        Parameter parameter = axisOp.getParameter(StatisticsConstants.OPERATION_FAULT_COUNTER);
        if (parameter != null) {
            count += ((AtomicInteger) parameter.getValue()).get();
        }
    }
    return count;
}
 
Example #11
Source File: SystemStatisticsUtil.java    From carbon-commons with Apache License 2.0 5 votes vote down vote up
public int getServiceResponseCount(AxisService axisService) throws AxisFault {
    int count = 0;
    for (Iterator opIter = axisService.getOperations(); opIter.hasNext();) {
        AxisOperation axisOp = (AxisOperation) opIter.next();
        Parameter parameter = axisOp.getParameter(StatisticsConstants.OUT_OPERATION_COUNTER);
        if (parameter != null) {
            count += ((AtomicInteger) parameter.getValue()).get();
        }
    }
    return count;
}
 
Example #12
Source File: SystemStatisticsUtil.java    From carbon-commons with Apache License 2.0 5 votes vote down vote up
public int getOperationRequestCount(AxisOperation axisOperation) throws AxisFault {
    Parameter parameter =
            axisOperation.getParameter(StatisticsConstants.IN_OPERATION_COUNTER);
    if (parameter != null) {
        return ((AtomicInteger) parameter.getValue()).get();
    }
    return 0;
}
 
Example #13
Source File: SystemStatisticsUtil.java    From carbon-commons with Apache License 2.0 5 votes vote down vote up
public int getOperationFaultCount(AxisOperation axisOperation) throws AxisFault {
    Parameter parameter =
            axisOperation.getParameter(StatisticsConstants.OPERATION_FAULT_COUNTER);
    if (parameter != null) {
        return ((AtomicInteger) parameter.getValue()).get();
    }
    return 0;
}
 
Example #14
Source File: WSDLToDataService.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
private static AxisMessage getAxisMessageFromOperation(
		AxisOperation axisOperation, String direction) {
	Iterator<AxisMessage> msgs = axisOperation.getMessages();
	AxisMessage tmpAxisMessage = null;
	while (msgs.hasNext()) {
		tmpAxisMessage = msgs.next();
		if (tmpAxisMessage.getDirection().equals(direction)) {
			return tmpAxisMessage;
		}
	}		
	return null;
}
 
Example #15
Source File: SystemStatisticsUtil.java    From carbon-commons with Apache License 2.0 5 votes vote down vote up
public int getOperationResponseCount(AxisOperation axisOperation) throws AxisFault {
    Parameter parameter =
            axisOperation.getParameter(StatisticsConstants.OUT_OPERATION_COUNTER);
    if (parameter != null) {
        return ((AtomicInteger) parameter.getValue()).get();
    }
    return 0;
}
 
Example #16
Source File: DBDeployer.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
/**
 * Creates AxisBindingOperation and populates it with SOAP 1.1 properties
 */
private AxisBindingOperation createDefaultSOAP11BindingOperation(
		AxisOperation axisOp, String httpLocation, String inputAction,
		AxisBinding soap11Binding) {
	AxisBindingOperation soap11BindingOperation = new AxisBindingOperation();
	soap11BindingOperation.setAxisOperation(axisOp);
	soap11BindingOperation.setName(axisOp.getName());
	soap11BindingOperation.setParent(soap11Binding);
	soap11BindingOperation.setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION,
			httpLocation);
	soap11Binding.addChild(soap11BindingOperation.getName(), soap11BindingOperation);
	soap11BindingOperation.setProperty(WSDL2Constants.ATTR_WSOAP_ACTION, inputAction);
	return soap11BindingOperation;
}
 
Example #17
Source File: DBDeployer.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
/**
 * Creates AxisBindingOperation and populates it with SOAP 1.2 properties
 */
private AxisBindingOperation createDefaultSOAP12BindingOperation(
		AxisOperation axisOp, String httpLocation, String inputAction,
		AxisBinding soap12Binding) {
	AxisBindingOperation soap12BindingOperation = new AxisBindingOperation();
	soap12BindingOperation.setAxisOperation(axisOp);
	soap12BindingOperation.setName(axisOp.getName());
	soap12BindingOperation.setParent(soap12Binding);
	soap12BindingOperation.setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION,
			httpLocation);
	soap12Binding.addChild(soap12BindingOperation.getName(), soap12BindingOperation);
	soap12BindingOperation.setProperty(WSDL2Constants.ATTR_WSOAP_ACTION, inputAction);
	return soap12BindingOperation;
}
 
Example #18
Source File: DBDeployer.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
/**
 * Creates AxisBindingOperation and populates it with HTTP properties
 */
private AxisBindingOperation createDefaultHTTPBindingOperation(
		AxisOperation axisOp, String httpLocation, String httpMethod,
		AxisBinding httpBinding) {
	AxisBindingOperation httpBindingOperation = new AxisBindingOperation();
	httpBindingOperation.setAxisOperation(axisOp);
	httpBindingOperation.setName(axisOp.getName());
	httpBindingOperation.setParent(httpBinding);
	httpBindingOperation.setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION, httpLocation);
	httpBindingOperation.setProperty(WSDL2Constants.ATTR_WHTTP_METHOD, httpMethod);
	httpBinding.addChild(httpBindingOperation.getName(), httpBindingOperation);
	return httpBindingOperation;
}
 
Example #19
Source File: SystemStatisticsUtil.java    From carbon-commons with Apache License 2.0 5 votes vote down vote up
public long getMaxOperationResponseTime(AxisOperation axisOperation) throws AxisFault {
    long max = 0;
    Parameter parameter =
            axisOperation.getParameter(StatisticsConstants.OPERATION_RESPONSE_TIME_PROCESSOR);
    if (parameter != null) {
        max = ((ResponseTimeProcessor) parameter.getValue()).getMaxResponseTime();
    }
    return max;
}
 
Example #20
Source File: DBDeployer.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
/**
 * Creates an AxisOperation with the given data service resource object.
 * @see Operation
 * @see AxisOperation
 */
private AxisOperation createAxisOperationFromDSResource(Resource resource,
                                                           AxisBinding soap11Binding, AxisBinding soap12Binding,
                                                           AxisBinding httpBinding) {
	Resource.ResourceID resourceId = resource.getResourceId();
	String method = resourceId.getMethod();
	String path = resourceId.getPath();
	String requestName = resource.getRequestName();
	String description = resource.getDescription();
	boolean hasResult = resource.getCallQuery().isHasResult()
			|| resource.isReturnRequestStatus();
	return createAxisOperation(requestName, path, method, hasResult, soap11Binding,
			soap12Binding, httpBinding, description);
}
 
Example #21
Source File: SystemStatisticsUtil.java    From carbon-commons with Apache License 2.0 5 votes vote down vote up
public long getMinOperationResponseTime(AxisOperation axisOperation) throws AxisFault {
    long min = 0;
    Parameter parameter =
            axisOperation.getParameter(StatisticsConstants.OPERATION_RESPONSE_TIME_PROCESSOR);
    if (parameter != null) {
        min = ((ResponseTimeProcessor) parameter.getValue()).getMinResponseTime();
    }
    if (min == -1) {
        min = 0;
    }
    return min;
}
 
Example #22
Source File: SystemStatisticsUtil.java    From carbon-commons with Apache License 2.0 5 votes vote down vote up
public double getAvgOperationResponseTime(AxisOperation axisOperation) throws AxisFault {
    double avg = 0;
    Parameter parameter =
            axisOperation.getParameter(StatisticsConstants.OPERATION_RESPONSE_TIME_PROCESSOR);
    if (parameter != null) {
        avg = ((ResponseTimeProcessor) parameter.getValue()).getAvgResponseTime();
    }
    return avg;
}
 
Example #23
Source File: DataServiceDocLitWrappedSchemaGenerator.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
/**
 * Process the given request's output types.
 * @param cparams The common parameters used in the schema generator
 * @param request The request used to process the output
 */
private static void processRequestOutput(CommonParams cparams, CallableRequest request)
           throws DataServiceFault {
	CallQuery callQuery = request.getCallQuery();
	if (!(callQuery.getQuery().hasResult() || request.isReturnRequestStatus())) {
		return;
	}
	
	AxisOperation axisOp = cparams.getAxisService().getOperation(
			new QName(request.getRequestName()));
	AxisMessage outMessage = axisOp.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
	outMessage.setName(request.getRequestName() + Java2WSDLConstants.RESPONSE);
	
	if (request.isReturnRequestStatus() && !callQuery.getQuery().hasResult()) {
		outMessage.setElementQName(new QName(DBConstants.WSO2_DS_NAMESPACE,
				DBConstants.REQUEST_STATUS_WRAPPER_ELEMENT));
		return;
	}
	
	Result result = callQuery.getQuery().getResult();
	if (result.isXsAny() || result.getResultType() == ResultTypes.RDF) {
		outMessage.setElementQName(new QName(DBConstants.WSO2_DS_NAMESPACE,
				DBConstants.DATA_SERVICE_RESPONSE_WRAPPER_ELEMENT));
		return;
	}
	
	/* create dummy element to contain the result element */
	XmlSchemaElement dummyParentElement = new XmlSchemaElement();
	dummyParentElement.setQName(new QName(result.getNamespace(), DUMMY_NAME));
	XmlSchema dummySchema = retrieveSchema(cparams, result.getNamespace());
	XmlSchemaComplexType dummyType = new XmlSchemaComplexType(dummySchema);
	dummyType.setName(DUMMY_NAME);
	dummyParentElement.setType(dummyType);
	/* lets do it */
	processCallQuery(cparams, dummyParentElement, callQuery);
	/* extract the element and set it to the message */
	XmlSchemaElement resultEl = (XmlSchemaElement) ((XmlSchemaSequence) dummyType.getParticle())
			.getItems().getItem(0);
	outMessage.setElementQName(resultEl.getRefName());
}
 
Example #24
Source File: ServiceHTMLProcessor.java    From micro-integrator with Apache License 2.0 4 votes vote down vote up
public static String printServiceHTML(String serviceName,
                                      ConfigurationContext configurationContext) {
    StringBuffer temp = new StringBuffer();
    try {
        AxisConfiguration axisConfig = configurationContext.getAxisConfiguration();
        AxisService axisService = axisConfig.getService(serviceName);
        if (axisService != null) {
            if (!axisService.isActive()) {
                temp.append("<b>Service ").append(serviceName).
                        append(" is inactive. Cannot display service information.</b>");
            } else {
                temp.append("<h3>").append(axisService.getName()).append("</h3>");
                temp.append("<a href=\"").append(axisService.getName()).append("?wsdl\">wsdl</a> : ");
                temp.append("<a href=\"").append(axisService.getName()).append("?xsd\">schema</a> : ");
                temp.append("<a href=\"").append(axisService.getName()).append("?policy\">policy</a><br/>");
                temp.append("<i>Service Description :  ").
                        append(axisService.getDocumentation()).append("</i><br/><br/>");

                for (Iterator pubOpIter = axisService.getPublishedOperations().iterator();
                     pubOpIter.hasNext();) {
                    temp.append("Published operations <ul>");
                    for (; pubOpIter.hasNext();) {
                        AxisOperation axisOperation = (AxisOperation) pubOpIter.next();
                        temp.append("<li>").
                                append(axisOperation.getName().getLocalPart()).append("</li>");
                    }
                    temp.append("</ul>");
                }
            }
        } else {
            temp.append("<b>Service ").append(serviceName).
                    append(" not found. Cannot display service information.</b>");
        }
        return "<html><head><title>Service Information</title></head>" + "<body>" + temp
               + "</body></html>";
    }
    catch (AxisFault axisFault) {
        return "<html><head><title>Error Occurred</title></head>" + "<body>"
               + "<hr><h2><font color=\"blue\">" + axisFault.getMessage() + "</font></h2></body></html>";
    }
}
 
Example #25
Source File: StatisticsAdmin.java    From carbon-commons with Apache License 2.0 4 votes vote down vote up
private AxisOperation getAxisOperation(String serviceName,
                                       String operationName) {
    return getAxisService(serviceName).getOperation(new QName(operationName));
}
 
Example #26
Source File: InOutMEPHandler.java    From carbon-commons with Apache License 2.0 4 votes vote down vote up
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;
}
 
Example #27
Source File: InOnlyMEPHandler.java    From carbon-commons with Apache License 2.0 4 votes vote down vote up
@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 #28
Source File: AbstractXDSRawXMLInMessageReceiver.java    From openxds with Apache License 2.0 4 votes vote down vote up
private Method findOperation(AxisOperation op, Class implClass) throws AxisFault {

		Method method = (Method) (op.getParameterValue("myMethod"));

		if (method != null)
			return method;

		String methodName = op.getName().getLocalPart();

		try {

			// Looking for a method of the form "void method(OMElement)"

			
			method = implClass.getMethod(methodName,
					new Class[] { OMElement.class });

//			if (1 == 1) 
//				throw new Exception("return type is " + method.getReturnType().getName() + "\n" +
//						"methodName is " + methodName + "\n" +
//						"class is " + implClass.getName());
			
			if (method.getReturnType().getName().equals("void")) {
				try {
					op.addParameter("myMethod", method);
				} catch (AxisFault axisFault) {
					throw AxisFault.makeFault(axisFault);
				}
				return method;
			}

		} catch (Exception e) {
			throw AxisFault.makeFault(e);
		}
		
		if (logger.isDebugEnabled()) {
			logger.debug("return class is " + method.getReturnType().getName());
		}
		
		return null;

	}
 
Example #29
Source File: DataServiceDocLitWrappedSchemaGenerator.java    From micro-integrator with Apache License 2.0 4 votes vote down vote up
/**
     * Process the given request's input parameters. //todo complete
     * @param cparams The common parameters used in the schema generator
     * @param request The request used to process the input
     */
    private static void processRequestBoxInput(CommonParams cparams, CallableRequest request, List<List<CallableRequest>> allOps)
            throws DataServiceFault {
        String requestName = request.getRequestName();
        AxisOperation axisOp = cparams.getAxisService().getOperation(new QName(requestName));
        CallQuery callQuery = request.getCallQuery();
        Query query = callQuery.getQuery();
        AxisMessage inMessage = axisOp.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
        if (inMessage != null) {
            inMessage.setName(requestName + Java2WSDLConstants.MESSAGE_SUFFIX);
                /* create input message element */
            XmlSchemaElement inputElement = createElement(cparams, query.getInputNamespace(),
                                                          requestName, true);
                /* complex type for input message element */
            XmlSchemaComplexType inputComplexType = createComplexType(cparams,
                                                                      query.getInputNamespace(), requestName, false);
                /* set element type */
            inputElement.setType(inputComplexType);
                /* batch requests */
            for (List<CallableRequest> callableRequests : allOps) {
                for (CallableRequest callableRequest : callableRequests) {
                    XmlSchemaElement nestedEl = new XmlSchemaElement();
                    if (callableRequest != null) {
                        if (!isBoxcarringOp(callableRequest.getRequestName())) {
                            nestedEl.setRefName(cparams.getRequestInputElementMap().get(
                                    callableRequest.getRequestName()));
//                            nestedEl.setMaxOccurs(Long.MAX_VALUE);
                            addElementToComplexTypeAll(cparams, inputComplexType,
                                                       query.getInputNamespace(),
                                                       nestedEl, false, false, true);
                        }
                    } else {
                        throw new DataServiceFault("No parent operation for batch request: "
                                                   + request.getRequestName());
                    }
                }
            }
                /* set the input element qname in message */
            inMessage.setElementQName(inputElement.getQName());
                /* store request name and element qname mapping */
            cparams.getRequestInputElementMap().put(request.getRequestName(),
                                                    inMessage.getElementQName());

        }
    }
 
Example #30
Source File: ServiceAdmin.java    From micro-integrator with Apache License 2.0 4 votes vote down vote up
public ServiceMetaData getServiceData(String serviceName) throws Exception {

        AxisService service = axisConfiguration.getServiceForActivation(serviceName);

        if (service == null) {
            String msg = "Invalid service name, service not found : " + serviceName;
            throw new AxisFault(msg);
        }

        String serviceType = getServiceType(service);
        List<String> ops = new ArrayList<String>();
        for (Iterator<AxisOperation> opIter = service.getOperations(); opIter.hasNext(); ) {
            AxisOperation axisOperation = opIter.next();

            if (axisOperation.getName() != null) {
                ops.add(axisOperation.getName().getLocalPart());
            }
        }

        ServiceMetaData serviceMetaData = new ServiceMetaData();
        serviceMetaData.setOperations(ops.toArray(new String[ops.size()]));
        serviceMetaData.setName(serviceName);
        serviceMetaData.setServiceId(serviceName);
        serviceMetaData.setServiceVersion("");
        serviceMetaData.setActive(service.isActive());
        String[] eprs = this.getServiceEPRs(serviceName);
        serviceMetaData.setEprs(eprs);
        serviceMetaData.setServiceType(serviceType);

        serviceMetaData.setWsdlURLs(Utils.getWsdlInformation(serviceName, axisConfiguration));

        AxisServiceGroup serviceGroup = (AxisServiceGroup) service.getParent();
        serviceMetaData.setFoundWebResources(serviceGroup.isFoundWebResources());
        serviceMetaData.setScope(service.getScope());
        serviceMetaData.setWsdlPorts(service.getEndpoints());
        Parameter deploymentTime = service.getParameter("serviceDeploymentTime");
        if (deploymentTime != null) {
            serviceMetaData.setServiceDeployedTime((Long) deploymentTime.getValue());
        }

        serviceMetaData.setServiceGroupName(serviceGroup.getServiceGroupName());

        if (service.getDocumentation() != null) {
            serviceMetaData.setDescription(service.getDocumentation());
        } else {
            serviceMetaData.setDescription("No service description found");
        }

        Parameter parameter = service.getParameter("enableMTOM");
        if (parameter != null) {
            serviceMetaData.setMtomStatus((String) parameter.getValue());
        } else {
            serviceMetaData.setMtomStatus("false");
        }

        parameter = service.getParameter("disableTryIt");
        if (parameter != null && Boolean.TRUE.toString().equalsIgnoreCase((String) parameter.getValue())) {
            serviceMetaData.setDisableTryit(true);
        }

        return serviceMetaData;
    }