Package org.codehaus.xfire.service

Examples of org.codehaus.xfire.service.MessageInfo


       
        List<String> partNames = new ArrayList<String>();
       
        Map<String, ParamInfo> params = new HashMap<String, ParamInfo>();
        // input parts
        MessageInfo inputMsg = op.getInputMessage();
        for (Iterator pitr = inputMsg.getMessageParts().iterator(); pitr.hasNext();)
        {
            MessagePartInfo part = (MessagePartInfo) pitr.next();
           
            String varName = getUniqueName(javify(part.getName().getLocalPart()), partNames);
            partNames.add(varName);

            JType paramType = schema.getType(context, part);
            ParamInfo param = new ParamInfo(paramType,varName);
            param.setIn(true);
            param.setName(part.getName());
            param.setPart(part);
            params.put(varName, param );

        }
  
        // input parts for each binding
        for (Iterator itr = bindings.iterator(); itr.hasNext();)
        {
            Binding binding = (Binding) itr.next();
            annotate(context, op, method, binding);
           
            List headers = binding.getHeaders(inputMsg).getMessageParts();
            for (Iterator bitr = headers.iterator(); bitr.hasNext();)
            {
                MessagePartInfo part = (MessagePartInfo) bitr.next();
               
                String varName = getUniqueName(javify(part.getName().getLocalPart()), partNames);
                partNames.add(varName);

                JType paramType = schema.getType(context, part);

                ParamInfo param = new ParamInfo(paramType,varName, true);
                param.setIn(true);
                param.setName(part.getName());
                param.setPart(part);
                params.put(varName, param);
               
            }
        }

        if (op.hasOutput() && op.getOutputMessage().size() > 0)
        {
            MessageInfo outputMsg = op.getOutputMessage();
            Iterator rtitr = outputMsg.getMessageParts().iterator();
            MessagePartInfo returnPart = (MessagePartInfo) rtitr.next();
           
            annotateReturnType(method, returnPart);
           
            for (Iterator itr = bindings.iterator(); itr.hasNext();)
View Full Code Here


        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());
                }
            }
        }
View Full Code Here

    {
        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);
          namespaces.add(ns);
        }
       
        for(Iterator iter = namespaces.iterator();iter.hasNext();){
          String ns = (String) iter.next();
          try {
        NamespaceHelper.getUniquePrefix(writer,ns, true);
      } catch (XMLStreamException e) {
         throw new XFireFault("Could not write to outgoing stream.", e, XFireFault.RECEIVER);
      }
        }
         
       
        for(Iterator itr = msgInfo.getMessageParts().iterator(); itr.hasNext();)
        {
            MessagePartInfo outParam = (MessagePartInfo) itr.next();

            try
            {
View Full Code Here

            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();)
            {
                MessagePartInfo outParam = (MessagePartInfo) itr.next();
               
                Object value;
                if (client)
View Full Code Here

        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;
        }

        Binding binding = context.getBinding();
        for (Iterator itr = msg.getMessageParts().iterator(); itr.hasNext();)
        {
            MessagePartInfo p = (MessagePartInfo) itr.next();

            params.add( service.getBindingProvider().readParameter(p, message.getXMLStreamReader(), context) );
View Full Code Here

    {
        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();
            context.getService().getBindingProvider().writeParameter(p, writer, context, values[i]);
            i++;
View Full Code Here

            final OperationInfo operation = context.getExchange().getOperation();

            // read in the headers
            Binding binding = context.getBinding();
           
            MessageInfo msg = AbstractBinding.getIncomingMessageInfo(context);
            MessageInfo outMsg = AbstractBinding.getOutgoingMessageInfo(context);
            MessagePartContainer headerMsg = binding.getHeaders(msg);
            MessagePartContainer outHeaderMsg = null;
            if (outMsg != null) outHeaderMsg = binding.getHeaders(outMsg);
           
            final Object[] paramArray = fillInHolders(context, operation, msg, outMsg, headerMsg, outHeaderMsg, params);
View Full Code Here

        context.setProperty(PostInvocationHandler.RESPONSE_VALUE, value);
    }
   
    public static void writeHeaders(MessageContext context, Object responseValue) throws XFireFault, XMLStreamException
    {
        MessageInfo msgInfo = AbstractBinding.getOutgoingMessageInfo(context);
        MessagePartContainer headers = context.getBinding().getHeaders(msgInfo);
        if (headers.size() == 0) return;
        Object[] body = (Object[]) context.getCurrentMessage().getBody();
       
        JDOMStreamWriter writer = new JDOMStreamWriter(context.getOutMessage().getOrCreateHeader());
View Full Code Here

            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());

            if (p == null)
            {
                throw new XFireFault("Parameter " + dr.getName() + " does not exist!",
                                     XFireFault.SENDER);
View Full Code Here

TOP

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

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.