Package org.codehaus.xfire.service

Examples of org.codehaus.xfire.service.OperationInfo


    {
        ServiceInfo service = endpoint.getServiceInfo();

        final String opName = getOperationName(service, method);

        final OperationInfo op = service.addOperation(opName, method);

        final Class[] paramClasses = method.getParameterTypes();

        boolean isDoc = style.equals(SoapConstants.STYLE_DOCUMENT);

        // Setup the input message
        MessageInfo inMsg = op.createMessage(createInputMessageName(op));
        op.setInputMessage(inMsg);

        for (int j = 0; j < paramClasses.length; j++)
        {
            if (!paramClasses[j].equals(MessageContext.class) &&
                    !isHeader(method, j) &&
                    isInParam(method, j))
            {
                final QName q = getInParameterName(endpoint, op, method, j, isDoc);
                MessagePartInfo part = inMsg.addMessagePart(q, paramClasses[j]);
                part.setIndex(j);
                part.setDocumentation(getDocumentationProvider().getParamters(op, j));
                part.setSchemaElement(isDoc || endpoint.getServiceInfo().isWrapped());
            }
        }

        String mep = getMEP(method);
        op.setMEP(mep);
        if (hasOutMessage(mep))
        {
            // Setup the output message
            MessageInfo outMsg = op.createMessage(createOutputMessageName(op));
            op.setOutputMessage(outMsg);

            final Class returnType = method.getReturnType();
            if (!returnType.isAssignableFrom(void.class) && !isHeader(method, -1))
            {
                final QName q = getOutParameterName(endpoint, op, method, -1, isDoc);
                MessagePartInfo part = outMsg.addMessagePart(q, method.getReturnType());
                part.setIndex(-1);
                part.setDocumentation(getDocumentationProvider().getResultDocumentation(op));
               
                part.setSchemaElement(isDoc || endpoint.getServiceInfo().isWrapped());
            }
           
            for (int j = 0; j < paramClasses.length; j++)
            {
                if (!paramClasses[j].equals(MessageContext.class) &&
                        !isHeader(method, j) &&
                        isOutParam(method, j))
                {
                    final QName q = getInParameterName(endpoint, op, method, j, isDoc);
                    MessagePartInfo part = outMsg.addMessagePart(q, paramClasses[j]);
                    part.setIndex(j);
                    part.setSchemaElement(isDoc || endpoint.getServiceInfo().isWrapped());
                }
            }
        }

        if (isCustomFaultsEnabled())
            initializeFaults(endpoint, op);
       
        op.setAsync(isAsync(method));
        op.setDocumenation(documentationProvider.getOperationDoc(op));
        return op;
    }
View Full Code Here


    }

    public void writeMessage(OutMessage message, XMLStreamWriter writer, MessageContext context)
        throws XFireFault
    {
        OperationInfo op = context.getExchange().getOperation();
        Object[] values = (Object[]) message.getBody();
        int i = 0;
       
        MessageInfo msgInfo = null;
        boolean client = isClientModeOn(context);
        if (client)
        {
            msgInfo = op.getInputMessage();
        }
        else
        {
            msgInfo = op.getOutputMessage();
        }
        Set namespaces = new HashSet();
        for(Iterator itr = msgInfo.getMessageParts().iterator(); itr.hasNext();){
          MessagePartInfo outParam = (MessagePartInfo) itr.next();
          String ns = getBoundNamespace(context, outParam);
View Full Code Here

        DepthXMLStreamReader dr = new DepthXMLStreamReader(context.getInMessage().getXMLStreamReader());

        if ( !STAXUtils.toNextElement(dr) )
            throw new XFireFault("There must be a method name element.", XFireFault.SENDER);
       
        OperationInfo op = context.getExchange().getOperation();

        if (!isClientModeOn(context) && op == null)
        {
            op = endpoint.getServiceInfo().getOperation( dr.getLocalName() );
           
View Full Code Here

        try
        {
            Service endpoint = context.getService();
            Object[] values = (Object[]) message.getBody();
           
            OperationInfo op = context.getExchange().getOperation();
            String name;

            MessageInfo msgInfo;
            boolean client = isClientModeOn(context);
            if (client)
            {
                name = op.getName();
                msgInfo = op.getInputMessage();
            }
            else
            {
                name = op.getName() + "Response";
                msgInfo = op.getOutputMessage();
            }

            writeStartElement(writer, name, msgInfo.getName().getNamespaceURI());
           
            for(Iterator itr = msgInfo.getMessageParts().iterator(); itr.hasNext();)
View Full Code Here

    public void readMessage(InMessage message, MessageContext context)
        throws XFireFault
    {
        final Service service = context.getService();
       
        OperationInfo operation = context.getExchange().getOperation();

        if (context.getExchange().getOperation() == null)
        {
            operation = (OperationInfo) service.getServiceInfo().getOperations().iterator().next();
           
            setOperation(operation, context);
        }

        DepthXMLStreamReader dr = new DepthXMLStreamReader(message.getXMLStreamReader());

        final List params = new ArrayList();
        message.setBody( params );

        MessageInfo msg;
        if (context.getClient() != null)
        {
            msg = operation.getOutputMessage();
        }
        else
        {
            msg = operation.getInputMessage();
        }
       
        if (!STAXUtils.toNextElement(dr))
        {
            return;
View Full Code Here

    public void writeMessage(OutMessage message, XMLStreamWriter writer, MessageContext context)
        throws XFireFault
    {
        Object[] values = (Object[]) message.getBody();
        final OperationInfo operation = context.getExchange().getOperation();
       
        int i = 0;
        MessageInfo msg;
        if (context.getClient() != null)
        {
            msg = operation.getInputMessage();
        }
        else
        {
            msg = operation.getOutputMessage();
        }
       
        for (Iterator itr = msg.getMessageParts().iterator(); itr.hasNext();)
        {
            MessagePartInfo p = (MessagePartInfo) itr.next();
View Full Code Here

            // Read in the parameters...
            final List params = (List) context.getInMessage().getBody();

            // Don't read the operation in until after reading. Otherwise
            // it won't work for document style services.
            final OperationInfo operation = context.getExchange().getOperation();

            // read in the headers
            Binding binding = context.getBinding();
           
            MessageInfo msg = AbstractBinding.getIncomingMessageInfo(context);
View Full Code Here

       
        String opName = dr.getLocalName();
        if (isClientModeOn(context))
            opName = opName.substring(0, opName.lastIndexOf("Response"));
       
        OperationInfo operation = endpoint.getServiceInfo().getOperation( opName );

        if (operation == null)
            throw new XFireFault("Could not find operation: " + opName, XFireFault.SENDER);
       
        // Move from operation element to whitespace or start element
        nextEvent(dr);
       
        setOperation(operation, context);

        if (operation == null)
        {
            throw new XFireFault("Invalid operation.", XFireFault.SENDER);
        }

        Service service = context.getService();
       
        MessageInfo msg;
        if (isClientModeOn(context))
            msg = operation.getOutputMessage();
        else
            msg = operation.getInputMessage();
       
        while(STAXUtils.toNextElement(dr))
        {
            MessagePartInfo p = (MessagePartInfo) msg.getMessageParts().get(parameters.size());
View Full Code Here

         * tm.getType(param.getTypeClass()); part2type.put(param, type); }
         */

        if (type == null)
        {
            OperationInfo op = param.getContainer().getOperation();

            if (paramtype != FAULT_PARAM)
            {
                /*
                 * Note: we are not registering the type here, because it is an
                 * anonymous type. Potentially there could be many schema types
                 * with this name. For example, there could be many ns:in0
                 * paramters.
                 */
                type = tm.getTypeCreator().createType(op.getMethod(), param.getIndex());
            }
            else
            {
                type = tm.getTypeCreator().createType(param.getTypeClass());
            }
View Full Code Here

        String action = (String) context.getInMessage().getProperty(SoapConstants.SOAP_ACTION);
       
        if (action == null || action.length() == 0) return;
       
        AbstractSoapBinding binding = (AbstractSoapBinding) context.getBinding();
        OperationInfo op = binding.getOperationByAction(action);
       
        if (op != null)
        {
            context.getExchange().setOperation(op);
        }
View Full Code Here

TOP

Related Classes of org.codehaus.xfire.service.OperationInfo

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.