Package org.apache.axis.description

Examples of org.apache.axis.description.OperationDesc


        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


//        }

        Collection operations = new ArrayList();
        Set wrapperElementQNames = buildOperations(binding, serviceEndpointInterface, isLightweight, portInfo, exceptionMap, classLoader, operations);
        for (Iterator iter = operations.iterator(); iter.hasNext();) {
            OperationDesc operation = (OperationDesc) iter.next();
            serviceDesc.addOperationDesc(operation);
        }

        TypeMappingRegistryImpl tmr = new TypeMappingRegistryImpl();
        tmr.doRegisterFromVersion("1.3");
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

            SchemaTypeKey key = (SchemaTypeKey) iter.next();
            qNameToKey.put(key.getqName(), key);
        }

        for (Iterator iter = operations.iterator(); iter.hasNext();) {
            OperationDesc operationDesc = (OperationDesc) iter.next();
            ArrayList parameters = new ArrayList(operationDesc.getParameters());
            ParameterDesc returnParameterDesc = operationDesc.getReturnParamDesc();
            if (null != returnParameterDesc.getTypeQName() &&
                    false == returnParameterDesc.getTypeQName().equals(XMLType.AXIS_VOID)) {
                parameters.add(returnParameterDesc);
            }
            for (Iterator iterator = parameters.iterator(); iterator.hasNext();) {
View Full Code Here

            // find the right one.  For each matching operation which has an
            // equal number of "in" parameters, try deserializing.  If we
            // don't succeed for any of the candidates, punt.

            for (int i = 0; i < operations.length; i++) {
                OperationDesc operation = operations[i];
                if (operation.getNumInParams() >= numParams) {
                    // Set the operation so the RPCHandler can get at it
                    rpcHandler.setOperation(operation);
                    try {
                        if (elementIsFirstParam && operation.getNumInParams() > 0) {
                            context.pushElementHandler(rpcHandler);
                            context.setCurElement(null);
                        } else {
                            context.pushElementHandler(
                                    new EnvelopeHandler(rpcHandler));
View Full Code Here

        ParameterDesc [] params = new ParameterDesc [] {
            new ParameterDesc(new QName("", "param1"), ParameterDesc.IN, null),
            new ParameterDesc(new QName("", "param2"), ParameterDesc.IN, null),
            new ParameterDesc(new QName("", "param3"), ParameterDesc.IN, null),
        };
        OperationDesc oper = new OperationDesc("method", params, null);
        desc.addOperationDesc(oper);
        config.deployService("testOmittedValue", service);

        String msg = header + missingParam2 + footer;
        Message message = new Message(msg);
View Full Code Here

     * @exception JAXRPCException - if isParameterAndReturnSpecRequired returns false, then
     * removeAllParameters will throw JAXRPCException.
     */
    public void removeAllParameters() {
        if (parmAndRetReq) {
            operation = new OperationDesc();
        }
        else {
            throw new JAXRPCException();
        }
    }
View Full Code Here

        // PortType name is the name of the class being processed
        portType.setQName(new javax.wsdl.QName(intfNS, getPortTypeName()));

        ArrayList operations = serviceDesc.getOperations();
        for (Iterator i = operations.iterator(); i.hasNext();) {
            OperationDesc thisOper = (OperationDesc)i.next();
            BindingOperation bindingOper = writeOperation(def,
                                                          binding,
                                                          thisOper);
            Operation oper = bindingOper.getOperation();
            writeMessages(def, oper, thisOper, bindingOper);
View Full Code Here

                "RPCProvider.processMessage()"));
        }

        SOAPService service = msgContext.getService();
        ServiceDesc serviceDesc = service.getServiceDescription();
        OperationDesc operation = msgContext.getOperation();

        Vector          bodies = reqEnv.getBodyElements();
        if (log.isDebugEnabled()) {
            log.debug(JavaUtils.getMessage("bodyElems00", "" + bodies.size()));
            log.debug(JavaUtils.getMessage("bodyIs00", "" + bodies.get(0)));
        }

        /* Loop over each entry in the SOAPBody - each one is a different */
        /* RPC call.                                                      */
        /******************************************************************/
        for ( int bNum = 0 ; bNum < bodies.size() ; bNum++ ) {
            RPCElement   body;

            // If this is a regular old SOAPBodyElement, and it's a root,
            // we're probably a non-wrapped doc/lit service.  In this case,
            // we deserialize the element, and create an RPCElement "wrapper"
            // around it which points to the correct method.
            // FIXME : There should be a cleaner way to do this...
            if (!(bodies.get(bNum) instanceof RPCElement)) {
                SOAPBodyElement bodyEl = (SOAPBodyElement)bodies.get(bNum);
                // igors: better check if bodyEl.getID() != null
                // to make sure this loop does not step on SOAP-ENC objects
                // that follow the parameters! FIXME?
                if (bodyEl.isRoot() && operation != null) {
                    ParameterDesc param = operation.getParameter(bNum);
                    // at least do not step on non-existent parameters!
                    if(param != null) {
                        Object val = bodyEl.getValueAsType(param.getTypeQName());
                        body = new RPCElement("",
                                              operation.getName(),
                                              new Object [] { val });
                    }
                    else continue;
                } else {
                    continue;
                }
            } else {
                body = (RPCElement) bodies.get( bNum );
            }

            String methodName = body.getMethodName();
            Vector args = body.getParams();
            int numArgs = args.size();

            // This may have changed, so get it again...
            // FIXME (there should be a cleaner way to do this)
            operation = msgContext.getOperation();

            if (operation == null) {
                QName qname = new QName(body.getNamespaceURI(),
                                        body.getName());
                operation = serviceDesc.getOperationByElementQName(qname);
            }

            if (operation == null) {
                throw new AxisFault(JavaUtils.getMessage("noSuchOperation",
                                                         methodName));
            }

            // Create the array we'll use to hold the actual parameter
            // values.  We know how big to make it from the metadata.
            Object[]     argValues  =  new Object [operation.getNumParams()];

            // A place to keep track of the out params (INOUTs and OUTs)
            ArrayList outs = new ArrayList();

            // Put the values contained in the RPCParams into an array
            // suitable for passing to java.lang.reflect.Method.invoke()
            // Make sure we respect parameter ordering if we know about it
            // from metadata, and handle whatever conversions are necessary
            // (values -> Holders, etc)
            if ( args != null && args.size() > 0 ) {
                for ( int i = 0 ; i < numArgs ; i++ ) {
                    RPCParam rpcParam = (RPCParam)args.get(i);
                    Object value = rpcParam.getValue();
                    ParameterDesc paramDesc = rpcParam.getParamDesc();
                    if (paramDesc != null && paramDesc.getJavaType() != null) {
                        value = JavaUtils.convert(value,
                                                  paramDesc.getJavaType());
                        rpcParam.setValue(value);
                        if (paramDesc.getMode() == ParameterDesc.INOUT)
                            outs.add(rpcParam);
                    }
                    if (paramDesc == null || paramDesc.getOrder() == -1) {
                        argValues[i= value;
                    } else {
                        argValues[paramDesc.getOrder()] = value;
                    }

                    if (log.isDebugEnabled()) {
                        log.debug("  " + JavaUtils.getMessage("value00",
                            "" + argValues[i]) );
                    }
                }
            }

            // Check if we can find a Method by this name
            // FIXME : Shouldn't this type of thing have already occurred?
            checkMethodName(msgContext, allowedMethods, operation.getName());

            // Now create any out holders we need to pass in
            if (numArgs < argValues.length) {
                ArrayList outParams = operation.getOutParams();
                for (int i = 0; i < outParams.size(); i++) {
                    ParameterDesc param = (ParameterDesc)outParams.get(i);
                    Class holderClass = param.getJavaType();
                    if (Holder.class.isAssignableFrom(holderClass)) {
                        argValues[numArgs + i] = holderClass.newInstance();
                        // Store an RPCParam in the outs collection so we
                        // have an easy and consistent way to write these
                        // back to the client below
                        outs.add(new RPCParam(param.getQName(),
                                              argValues[numArgs + i]));
                    } else {
                        // !!! Throw a fault here?
                    }
                }
            }

            // OK!  Now we can invoke the method
            Object objRes = operation.getMethod().invoke(obj, argValues);

            /* Now put the result in the result SOAPEnvelope */
            /*************************************************/
            RPCElement resBody = new RPCElement(methodName + "Response");
            resBody.setPrefix( body.getPrefix() );
            resBody.setNamespaceURI( body.getNamespaceURI() );
            resBody.setEncodingStyle(msgContext.getEncodingStyle());

            // Return first
            if ( operation.getMethod().getReturnType() != Void.TYPE ) {
                QName returnQName = operation.getReturnQName();
                if (returnQName == null) {
                    returnQName = new QName("", methodName + "Return");
                }
                RPCParam param = new RPCParam(returnQName, objRes);
                resBody.addParam(param);
View Full Code Here

            SchemaTypeKey key = (SchemaTypeKey) iter.next();
            qNameToKey.put(key.getqName(), key);
        }

        for (Iterator iter = operations.iterator(); iter.hasNext();) {
            OperationDesc operationDesc = (OperationDesc) iter.next();
            ArrayList parameters = new ArrayList(operationDesc.getParameters());
            ParameterDesc returnParameterDesc = operationDesc.getReturnParamDesc();
            if (null != returnParameterDesc.getTypeQName() &&
                    false == returnParameterDesc.getTypeQName().equals(XMLType.AXIS_VOID)) {
                parameters.add(returnParameterDesc);
            }
            for (Iterator iterator = parameters.iterator(); iterator.hasNext();) {
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.