Package org.apache.axis2.description

Examples of org.apache.axis2.description.OperationDescription


    public ConfigurationContext getEngineContext() {
        return (ConfigurationContext) parent;
    }

    public OperationContext createOperationContext(QName name) {
        OperationDescription axisOp = serviceConfig.getOperation(name);
        return new OperationContext(axisOp, this);
    }
View Full Code Here


            configContext.getAxisConfiguration().getTransportIn(
                new QName(Constants.TRANSPORT_MAIL)));
        ml.start();

        ServiceDescription service = new ServiceDescription(serviceName);
        OperationDescription operation = new OperationDescription(operationName);
        operation.setMessageReciever(new MessageReceiver() {
            public void recieve(MessageContext messgeCtx) throws AxisFault {
                envelope = messgeCtx.getEnvelope();
            }
        });
        service.addOperation(operation);
View Full Code Here

        return method;
    }

    public void testOneWay() throws Exception {
        ServiceDescription service = new ServiceDescription(serviceName);
        OperationDescription operation = new OperationDescription(operationName);
        operation.setMessageReciever(new MessageReceiver() {
            public void recieve(MessageContext messgeCtx) throws AxisFault {
                envelope = messgeCtx.getEnvelope();
            }
        });
        service.addOperation(operation);
View Full Code Here

            // find the WebService method
            Class ImplClass = obj.getClass();
            DependencyManager.configureBusinussLogicProvider(obj,msgContext);

            OperationDescription op = msgContext.getOperationContext().getAxisOperation();
            if (op == null) {
                throw new AxisFault("Operation is not located, if this is doclit style the SOAP-ACTION should specified via the SOAP Action to use the RawXMLProvider");
            }
            String methodName = op.getName().getLocalPart();
            Method[] methods = ImplClass.getMethods();
            for (int i = 0; i < methods.length; i++) {
                if (methods[i].getName().equals(methodName)) {
                    this.method = methods[i];
                    break;
View Full Code Here

            Class ImplClass = obj.getClass();

            //Inject the Message Context if it is asked for
            DependencyManager.configureBusinussLogicProvider(obj, msgContext);

            OperationDescription opDesc = msgContext.getOperationContext().getAxisOperation();
            Method method = findOperation(opDesc, ImplClass);
            if (method != null) {
                String style = msgContext.getOperationContext().getAxisOperation().getStyle();

                Class[] parameters = method.getParameterTypes();
                Object[] args = null;

                if (parameters == null || parameters.length == 0) {
                    args = new Object[0];
                } else if (parameters.length == 1) {
                    OMElement omElement = null;
                    if (WSDLService.STYLE_DOC.equals(style)) {
                        omElement = msgContext.getEnvelope().getBody().getFirstElement();
                    } else if (WSDLService.STYLE_RPC.equals(style)) {
                        OMElement operationElement = msgContext.getEnvelope().getBody().getFirstElement();
                        if (operationElement != null) {
                            if (method.getName().equals(operationElement.getLocalName())
                               || operationElement.getLocalName() != null && operationElement.getLocalName().startsWith(method.getName()) ) {
                                omElement = operationElement.getFirstElement();
                            } else {
                                throw new AxisFault("Operation Name does not match the immediate child name, expected "+ method.getName() + " but get " + operationElement.getLocalName());
                            }
                        } else {
                            throw new AxisFault("rpc style expect the immediate child of the SOAP body ");
                        }
                    } else {
                        throw new AxisFault("Unknown style ");
                    }
                    args = new Object[] { omElement };
                } else {
                    throw new AxisFault(
                        "Raw Xml provider supports only the methods bearing the signature public OMElement "
                            + "&lt;method-name&gt;(OMElement) where the method name is anything");
                }

                OMElement result = (OMElement) method.invoke(obj, args);
               
                OMElement bodyContent = null;
                if (WSDLService.STYLE_RPC.equals(style)) {
                    OMNamespace ns = getSOAPFactory().createOMNamespace("http://soapenc/", "res");
                    bodyContent =
                        getSOAPFactory().createOMElement(method.getName() + "Response", ns);
                    bodyContent.addChild(result);
                }else{
                    bodyContent = result;
                }

                SOAPEnvelope envelope = getSOAPFactory().getDefaultEnvelope();
                if(bodyContent!= null){
                    envelope.getBody().addChild(bodyContent);
                }
                newmsgContext.setEnvelope(envelope);
            } else {
                throw new AxisFault(
                    "Implementation class does not define a method called" + opDesc.getName());
            }
        } catch (Exception e) {
            throw AxisFault.makeFault(e);
        }
View Full Code Here

     * @throws AxisFault
     */

    public OMElement invokeBlocking(String axisop, OMElement toSend) throws AxisFault {

        OperationDescription axisConfig =
            serviceContext.getServiceConfig().getOperation(new QName(axisop));
         if (axisConfig == null) {
            axisConfig = new OperationDescription(new QName(axisop));
            axisConfig.setRemainingPhasesInFlow(operationTemplate.getRemainingPhasesInFlow());
            axisConfig.setPhasesOutFlow(operationTemplate.getPhasesOutFlow());
            axisConfig.setPhasesInFaultFlow(operationTemplate.getPhasesInFaultFlow());
            axisConfig.setPhasesOutFaultFlow(operationTemplate.getPhasesOutFaultFlow());
            serviceContext.getServiceConfig().addOperation(axisConfig);
        }

//        if (axisConfig == null) {
//            axisConfig = new OperationDescription(new QName(axisop));
View Full Code Here

     * @throws AxisFault
     */

    public void invokeNonBlocking(String axisop, OMElement toSend, Callback callback)
        throws AxisFault {
        OperationDescription axisConfig =
            serviceContext.getServiceConfig().getOperation(new QName(axisop));
        if (axisConfig == null) {
            axisConfig = new OperationDescription(new QName(axisop));
            axisConfig.setRemainingPhasesInFlow(operationTemplate.getRemainingPhasesInFlow());
            axisConfig.setPhasesOutFlow(operationTemplate.getPhasesOutFlow());
            axisConfig.setPhasesInFaultFlow(operationTemplate.getPhasesInFaultFlow());
            axisConfig.setPhasesOutFaultFlow(operationTemplate.getPhasesOutFaultFlow());
            serviceContext.getServiceConfig().addOperation(axisConfig);
        }
        MessageContext msgctx = prepareTheSystem(toSend);

        super.invokeNonBlocking(axisConfig, msgctx, callback);
View Full Code Here

        }

        //create new service
        QName assumedServiceName = new QName("AnonnoymousService");
        ServiceDescription axisService = new ServiceDescription(assumedServiceName);
        operationTemplate = new OperationDescription(new QName("TemplateOperatin"));
        axisService.addOperation(operationTemplate);
        sysContext.getAxisConfiguration().addService(axisService);
        ServiceContext service = sysContext.createServiceContext(assumedServiceName);
        return service;
    }
View Full Code Here

    protected void setUp() throws Exception {
        UtilServer.start();

        ServiceDescription service = new ServiceDescription(serviceName);
        OperationDescription operation = new OperationDescription(operationName);
        operation.setMessageReciever(new MessageReceiver() {
            public void recieve(MessageContext messgeCtx) throws AxisFault {
                envelope = messgeCtx.getEnvelope();
                TestingUtils.campareWithCreatedOMElement(envelope.getBody().getFirstElement());
            }
        });
View Full Code Here

    public MessageSender() throws AxisFault {
        super(assumeServiceContext());
    }
    public void send(String opName, OMElement toSend) throws AxisFault {
        OperationDescription axisOp = serviceContext.getServiceConfig().getOperation(opName);
        if(axisOp == null){
            axisOp = new OperationDescription(new QName(opName));
            serviceContext.getServiceConfig().addOperation(axisOp);
        }
        super.send(axisOp, prepareTheSystem(toSend));
    }
View Full Code Here

TOP

Related Classes of org.apache.axis2.description.OperationDescription

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.