Package org.apache.axis.description

Examples of org.apache.axis.description.OperationDesc


       
        // Now we've got the service description loaded up.  We're going to
        // be testing parameter dispatch by name, so if debug info isn't
        // compiled into the Service class, the names are going to be "in0",
        // etc.  Make sure they match.
        OperationDesc oper = desc.getOperationByName("concatenate");
        assertNotNull(oper);
       
        firstParamName = oper.getParameter(0).getName();
        secondParamName = oper.getParameter(1).getName();
    }
View Full Code Here


                break;
        }

        // Operations
        for (final JaxRpcOperationInfo operationInfo : serviceInfo.operations) {
            final OperationDesc operationDesc = buildOperationDesc(operationInfo, serviceEndpointInterface);
            serviceDesc.addOperationDesc(operationDesc);
        }

        // Type mapping registry
        final TypeMappingRegistryImpl typeMappingRegistry = new TypeMappingRegistryImpl();
View Full Code Here

        return new ReadOnlyServiceDesc(serviceDesc);
    }

    private OperationDesc buildOperationDesc(final JaxRpcOperationInfo operationInfo, final Class serviceEndpointInterface) throws OpenEJBException {
        final OperationDesc operationDesc = new OperationDesc();
        operationDesc.setName(operationInfo.name);

        // Binding type
        switch (operationInfo.bindingStyle) {
            case RPC_ENCODED:
                operationDesc.setStyle(Style.RPC);
                operationDesc.setUse(Use.ENCODED);
                break;
            case RPC_LITERAL:
                operationDesc.setStyle(Style.RPC);
                operationDesc.setUse(Use.LITERAL);
                break;
            case DOCUMENT_ENCODED:
                operationDesc.setStyle(Style.DOCUMENT);
                operationDesc.setUse(Use.ENCODED);
                break;
            case DOCUMENT_LITERAL:
                operationDesc.setStyle(Style.DOCUMENT);
                operationDesc.setUse(Use.LITERAL);
                break;
            case DOCUMENT_LITERAL_WRAPPED:
                operationDesc.setStyle(Style.WRAPPED);
                operationDesc.setUse(Use.LITERAL);
                break;
        }

        // Operation style
        switch (operationInfo.operationStyle) {
            case NOTIFICATION:
                operationDesc.setMep(OperationType.NOTIFICATION);
                break;
            case ONE_WAY:
                operationDesc.setMep(OperationType.ONE_WAY);
                break;
            case REQUEST_RESPONSE:
                operationDesc.setMep(OperationType.REQUEST_RESPONSE);
                break;
            case SOLICIT_RESPONSE:
                operationDesc.setMep(OperationType.SOLICIT_RESPONSE);
                break;
        }

        // Build parameters
        final Class[] paramTypes = new Class[operationInfo.parameters.size()];
        int i = 0;
        for (final JaxRpcParameterInfo parameterInfo : operationInfo.parameters) {
            final ParameterDesc parameterDesc = buildParameterDesc(parameterInfo);
            operationDesc.addParameter(parameterDesc);
            paramTypes[i++] = parameterDesc.getJavaType();
        }

        // Java method
        try {
            final Method method = serviceEndpointInterface.getMethod(operationInfo.javaMethodName, paramTypes);
            operationDesc.setMethod(method);
        } catch (final NoSuchMethodException e) {
            String args = "";
            for (final Class paramType : paramTypes) {
                if (args.length() > 0) {
                    args += ", ";
                }
                args += paramType.getName();
            }
            throw new OpenEJBException("Mapping references non-existent method in service-endpoint: " + operationInfo.javaMethodName + "(" + args + ")");
        }

        //
        // Set return
        //
        if (operationInfo.returnQName != null) {
            operationDesc.setReturnQName(operationInfo.returnQName);
            operationDesc.setReturnType(operationInfo.returnXmlType);
            try {
                final Class<?> returnClass = classLoader.loadClass(operationInfo.returnJavaType);
                operationDesc.setReturnClass(returnClass);
            } catch (final ClassNotFoundException e) {
                throw new OpenEJBException();
            }
        } else if (operationInfo.operationStyle == JaxRpcOperationInfo.OperationStyle.REQUEST_RESPONSE) {
            operationDesc.setReturnQName(null);
            operationDesc.setReturnType(XMLType.AXIS_VOID);
            operationDesc.setReturnClass(void.class);
        }

        // Build faults
        for (final JaxRpcFaultInfo faultInfo : operationInfo.faults) {
            final FaultDesc faultDesc = buildFaultDesc(faultInfo);
            operationDesc.addFault(faultDesc);
        }

        return operationDesc;
    }
View Full Code Here

    }

    public void processMessage(final MessageContext msgContext, final SOAPEnvelope reqEnv, final SOAPEnvelope resEnv, final Object obj) throws Exception {

        final RPCElement body = getBody(reqEnv, msgContext);
        final OperationDesc operation = getOperationDesc(msgContext, body);

        final AxisRpcInterceptor interceptor = new AxisRpcInterceptor(operation, msgContext);
        final SOAPMessage message = msgContext.getMessage();

        try {
            message.getSOAPPart().getEnvelope();
            msgContext.setProperty(org.apache.axis.SOAPPart.ALLOW_FORM_OPTIMIZATION, Boolean.FALSE);

            final RpcContainer container = (RpcContainer) ejbDeployment.getContainer();

            final Object[] arguments = {msgContext, interceptor};

            final Class callInterface = ejbDeployment.getServiceEndpointInterface();
            final Object result = container.invoke(ejbDeployment.getDeploymentID(), InterfaceType.SERVICE_ENDPOINT, callInterface, operation.getMethod(), arguments, null);

            interceptor.createResult(result);
        } catch (final InvalidateReferenceException e) {
            interceptor.createExceptionResult(e.getCause());
        } catch (final ApplicationException e) {
            interceptor.createExceptionResult(e.getCause());
        } catch (final Throwable throwable) {
            throw new AxisFault("Web Service EJB Invocation failed: method " + operation.getMethod(), throwable);
        }
    }
View Full Code Here

        final TypeMapping typeMapping = tmr.getOrMakeTypeMapping(serviceDesc.getUse().getEncoding());

        serviceDesc.setTypeMappingRegistry(tmr);
        serviceDesc.setTypeMapping(typeMapping);

        final OperationDesc op = new OperationDesc();
        op.setName("echoString");
        op.setStyle(Style.RPC);
        op.setUse(Use.ENCODED);
        final Class beanClass = EchoBean.class;
        op.setMethod(beanClass.getMethod("echoString", String.class));
        final ParameterDesc parameter =
            new ParameterDesc(
                new QName("http://ws.apache.org/echosample", "in0"),
                ParameterDesc.IN,
                typeMapping.getTypeQName(String.class),
                String.class,
                false,
                false);
        op.addParameter(parameter);
        serviceDesc.addOperationDesc(op);

        serviceDesc.getOperations();
        final ReadOnlyServiceDesc sd = new ReadOnlyServiceDesc(serviceDesc);
View Full Code Here

    }

    public void processMessage(MessageContext msgContext, SOAPEnvelope reqEnv, SOAPEnvelope resEnv, Object obj) throws Exception {

        RPCElement body = getBody(reqEnv, msgContext);
        OperationDesc operation = getOperationDesc(msgContext, body);

        AxisRpcInterceptor interceptor = new AxisRpcInterceptor(operation, msgContext);
        SOAPMessage message = msgContext.getMessage();

        try {
            message.getSOAPPart().getEnvelope();
            msgContext.setProperty(org.apache.axis.SOAPPart.ALLOW_FORM_OPTIMIZATION, Boolean.FALSE);

            RpcContainer container = (RpcContainer) ejbDeployment.getContainer();

            Object[] arguments = {msgContext, interceptor};

            Class callInterface = ejbDeployment.getServiceEndpointInterface();
            Object result = container.invoke(ejbDeployment.getDeploymentID(), callInterface, operation.getMethod(), arguments, null);

            interceptor.createResult(result);
        } catch (InvalidateReferenceException e) {
            interceptor.createExceptionResult(e.getCause());
        } catch (ApplicationException e) {
            interceptor.createExceptionResult(e.getCause());
        } catch (Throwable throwable) {
            throw new AxisFault("Web Service EJB Invocation failed: method " + operation.getMethod(), throwable);
        }
    }
View Full Code Here

        TypeMapping typeMapping = tmr.getOrMakeTypeMapping(serviceDesc.getUse().getEncoding());

        serviceDesc.setTypeMappingRegistry(tmr);
        serviceDesc.setTypeMapping(typeMapping);

        OperationDesc op = new OperationDesc();
        op.setName("echoString");
        op.setStyle(Style.RPC);
        op.setUse(Use.ENCODED);
        Class beanClass = EchoBean.class;
        op.setMethod(beanClass.getMethod("echoString", new Class[] { String.class }));
        ParameterDesc parameter =
            new ParameterDesc(
                new QName("http://ws.apache.org/echosample", "in0"),
                ParameterDesc.IN,
                typeMapping.getTypeQName(String.class),
                String.class,
                false,
                false);
        op.addParameter(parameter);
        serviceDesc.addOperationDesc(op);

        serviceDesc.getOperations();
        ReadOnlyServiceDesc sd = new ReadOnlyServiceDesc(serviceDesc, Collections.EMPTY_LIST);
View Full Code Here

            writer.println(sb.toString());
            ArrayList operations = sd.getOperations();
            if (!operations.isEmpty()) {
                writer.println("<ul>");
                for (Iterator it = operations.iterator(); it.hasNext();) {
                    OperationDesc desc = (OperationDesc) it.next();
                    writer.println("<li>" + desc.getName());
                }
                writer.println("</ul>");
            }
        }
        writer.println("</ul>");
View Full Code Here

                    // Get all of the operations that have qname as
                    // a possible parameter QName
                    ArrayList allOperations = desc.getOperations();
                    ArrayList foundOperations = new ArrayList();
                    for (int i=0; i < allOperations.size(); i++ ) {
                        OperationDesc tryOp =
                            (OperationDesc) allOperations.get(i);
                        if (tryOp.getParamByQName(qname) != null) {
                            foundOperations.add(tryOp);
                        }
                    }
                    if (foundOperations.size() > 0) {
                        possibleOperations = (OperationDesc[])
View Full Code Here

     * @throws JavaUtils.HolderException
     */
    private Object[] proxyParams2CallParams(Object[] proxyParams)
        throws JavaUtils.HolderException
    {
        OperationDesc operationDesc = call.getOperation();
        if (operationDesc == null)
        {
            // we don't know which parameters are IN, OUT or INOUT
            // let's suppose they are all in
            return proxyParams;
        }

        Vector paramsCall = new Vector();
        for (int i = 0; proxyParams != null && i < proxyParams.length;i++)
        {
            Object param = proxyParams[i];
            ParameterDesc paramDesc = operationDesc.getParameter(i);

            if (paramDesc.getMode() == ParameterDesc.INOUT) {
                paramsCall.add(JavaUtils.getHolderValue((Holder)param));
            }
            else
View Full Code Here

TOP

Related Classes of org.apache.axis.description.OperationDesc

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.