Package org.apache.cxf.service.model

Examples of org.apache.cxf.service.model.MessageInfo


        throws Exception {
        OperationType opType = boi.getExtensor(OperationType.class);
        EventDataWriter writer = (EventDataWriter)getDataWriter(message);
        List<ParamType> paramTypes = opType.getParam();
        List<Object> args = message.getContent(List.class);
        MessageInfo msgInfo = message.get(MessageInfo.class);
        addMarshalRequestParams(message,
                                args,
                                boi,
                                paramTypes,
                                getXMLInputFactory(),
View Full Code Here


        return xif;
    }


    protected MessagePartInfo getInputMessagePartInfo(OperationInfo opInfo, int index) {
        MessageInfo msgInfo = opInfo.getInput();
        List<MessagePartInfo> parts = msgInfo.getMessageParts();
        MessagePartInfo part = parts.get(index);
        return part;   
    }
View Full Code Here

        MessagePartInfo part = parts.get(index);
        return part;   
    }

    protected MessagePartInfo getOutputMessagePartInfo(OperationInfo opInfo, int index) {
        MessageInfo msgInfo = opInfo.getOutput();
        List<MessagePartInfo> parts = msgInfo.getMessageParts();
        MessagePartInfo part = parts.get(index);
        return part;   
    }
View Full Code Here

        EasyMock.expect(bInfo.getOperation(qname)).andReturn(bopInfo);
        EasyMock.expect(bopInfo.getOperationInfo()).andReturn(opInfo);                       
        CorbaMessage message = control.createMock(CorbaMessage.class);
        Exchange exchange = control.createMock(Exchange.class);
        EndpointReferenceType etype = control.createMock(EndpointReferenceType.class);
        MessageInfo mInfo = control.createMock(MessageInfo.class);
        EasyMock.expect(message.getExchange()).andReturn(exchange);     
        EasyMock.expect(destination.getAddress()).andReturn(etype);
        EasyMock.expect(opInfo.getInput()).andReturn(mInfo);
        exchange.setInMessage(message);
        EasyMock.expectLastCall();       
View Full Code Here

    protected void addWrapperParams(Message message, BindingOperationInfo bopInfo, boolean isOutput)
        throws Exception {
        if (bopInfo.isUnwrappedCapable()) {
            OperationInfo opInfo = bopInfo.getOperationInfo();

            MessageInfo msgInfo = null;
            if (isOutput) {
                msgInfo = opInfo.getOutput();
            } else {
                msgInfo = opInfo.getInput();
            }
            Class wrapperTypeClass = msgInfo.getMessageParts().get(0).getTypeClass();
            opInfo = opInfo.getUnwrappedOperation();
            if (isOutput) {
                msgInfo = opInfo.getOutput();
            } else {
                msgInfo = opInfo.getInput();
            }
            List objs = message.getContent(List.class);
            if (objs != null) {
                Object wrapperType = wrapperTypeClass.newInstance();
                int i = 0;
                for (MessagePartInfo p : msgInfo.getMessageParts()) {
                    Object part = objs.get(i);
                    WrapperHelper.setWrappedPart(p.getName().getLocalPart(), wrapperType, part);
                    i++;
                }
                objs = new ArrayList<Object>();
View Full Code Here

     * WrapperClassIn & WrapperClassOut interceptors.
     */
    protected OperationInfo processWrappedOperation(BindingOperationInfo bopInfo, boolean isOutput)
        throws Exception {
        OperationInfo opInfo = bopInfo.getOperationInfo();
        MessageInfo msgInfo = null;
        if (bopInfo.isUnwrappedCapable()) {
            if (isOutput) {
                msgInfo = opInfo.getOutput();
            } else {
                msgInfo = opInfo.getInput();
            }
            Class wrapperTypeClass = msgInfo.getMessageParts().get(0).getTypeClass();
            opInfo = opInfo.getUnwrappedOperation();
            if (isOutput) {
                msgInfo = opInfo.getOutput();
            } else {
                msgInfo = opInfo.getInput();
            }
           
            for (MessagePartInfo part : msgInfo.getMessageParts()) {
                String elementType = null;
                if (part.isElement()) {
                    elementType = part.getElementQName().getLocalPart();
                } else if (part.getTypeQName() == null) {
                    // handling anonymous complex type
View Full Code Here

                                    EventDataReader reader)
        throws Exception {
        Object retValue = null;
       
        if (outMessage.getStreamableReturn() != null) {
            MessageInfo msgInfo = opInfo.getOutput();

            // Handle the parameters that are given for the operation
            XMLInputFactory inputFactory = XMLInputFactory.newInstance();
            XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
            outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES,
View Full Code Here

                                      OperationInfo opInfo,                                 
                                      EventDataReader reader,
                                      boolean isOutput)
        throws Exception {

        MessageInfo msgInfo;
        if (isOutput) {
            msgInfo = opInfo.getOutput();
        } else {
            msgInfo = opInfo.getInput();
        }
View Full Code Here

        Input input = op.getInput();
        if (input != null) {
            if (input.getMessage() == null) {
                throw new WSDLRuntimeException(LOG, "NO_MESSAGE", "input", op.getName(), input.getName());
            }
            MessageInfo minfo = opInfo.createMessage(input.getMessage().getQName(), MessageInfo.Type.INPUT);
            opInfo.setInput(input.getName(), minfo);
            buildMessage(minfo, input.getMessage());
            copyExtensors(minfo, input.getExtensibilityElements());
            copyExtensionAttributes(minfo, input);
        }
        Output output = op.getOutput();
        if (output != null) {
            if (output.getMessage() == null) {
                throw new WSDLRuntimeException(LOG, "NO_MESSAGE", "output", op.getName(), output.getName());
            }
            MessageInfo minfo = opInfo.createMessage(output.getMessage().getQName(), MessageInfo.Type.OUTPUT);
            opInfo.setOutput(output.getName(), minfo);
            buildMessage(minfo, output.getMessage());
            copyExtensors(minfo, output.getExtensibilityElements());
            copyExtensionAttributes(minfo, output);
        }
View Full Code Here

        checkForWrapped(opInfo, allowRefs, relaxed, Level.FINE);
    }

    public static void checkForWrapped(OperationInfo opInfo, boolean allowRefs,
                                       boolean relaxed, Level logLevel) {
        MessageInfo inputMessage = opInfo.getInput();
        MessageInfo outputMessage = opInfo.getOutput();
        boolean passedRule = true;
        // RULE No.1:
        // The operation's input and output message (if present) each contain
        // only a single part
        // input message must exist
        if (inputMessage == null || inputMessage.size() == 0
            || (inputMessage.size() > 1 && !relaxed)) {
            passedRule = false;
        }
        if (outputMessage != null && outputMessage.size() > 1) {
            passedRule = false;
        }

        if (!passedRule) {
            org.apache.cxf.common.i18n.Message message
                = new org.apache.cxf.common.i18n.Message("WRAPPED_RULE_1", LOG, opInfo.getName());
            LOG.log(logLevel, message.toString());
            return;
        }
        SchemaCollection schemas = opInfo.getInterface().getService().getXmlSchemaCollection();
        XmlSchemaElement inputEl = null;
        XmlSchemaElement outputEl = null;

        // RULE No.2:
        // The input message part refers to a global element declaration whose
        // local name is equal to the operation name.
        MessagePartInfo inputPart = inputMessage.getMessagePartByIndex(0);
        if (!inputPart.isElement()) {
            passedRule = false;
        } else {
            QName inputElementName = inputPart.getElementQName();
            inputEl = schemas.getElementByQName(inputElementName);
            if (inputEl == null) {
                passedRule = false;
            } else if (!opInfo.getName().getLocalPart().equals(inputElementName.getLocalPart())) {
                passedRule = relaxed;
            }
        }

        if (!passedRule) {
            org.apache.cxf.common.i18n.Message message
                = new org.apache.cxf.common.i18n.Message("WRAPPED_RULE_2", LOG, opInfo.getName());
            LOG.log(logLevel, message.toString());
            return;
        }
        // RULE No.3:
        // The output message part refers to a global element declaration
        MessagePartInfo outputPart = null;
        if (outputMessage != null && outputMessage.size() == 1) {
            outputPart = outputMessage.getMessagePartByIndex(0);
            if (outputPart != null) {
                if (!outputPart.isElement()
                    || schemas.getElementByQName(outputPart.getElementQName()) == null) {
                    passedRule = false;
                } else {
                    outputEl = schemas.getElementByQName(outputPart.getElementQName());
                }
            }
        }

        if (!passedRule) {
            org.apache.cxf.common.i18n.Message message
                = new org.apache.cxf.common.i18n.Message("WRAPPED_RULE_3", LOG, opInfo.getName());
            LOG.log(logLevel, message.toString());
            return;
        }
        // RULE No.4 and No5:
        // wrapper element should be pure complex type

        // Now lets see if we have any attributes...
        // This should probably look at the restricted and substitute types too.
        OperationInfo unwrapped = new UnwrappedOperationInfo(opInfo);
        MessageInfo unwrappedInput = new MessageInfo(unwrapped, MessageInfo.Type.INPUT,
                                                     inputMessage.getName());
        MessageInfo unwrappedOutput = null;

        XmlSchemaComplexType xsct = null;
        if (inputEl.getSchemaType() instanceof XmlSchemaComplexType) {

            xsct = (XmlSchemaComplexType)inputEl.getSchemaType();
            if (hasAttributes(xsct)
                || (inputEl.isNillable() && !relaxed)
                || !isWrappableSequence(xsct, inputEl.getQName().getNamespaceURI(),
                                        unwrappedInput, allowRefs)) {
                passedRule = false;
            }
        } else {
            passedRule = false;
        }

        if (!passedRule) {
            org.apache.cxf.common.i18n.Message message
                = new org.apache.cxf.common.i18n.Message("WRAPPED_RULE_4", LOG, opInfo.getName());
            LOG.log(logLevel, message.toString());
            return;
        }

        if (outputMessage != null) {
            unwrappedOutput = new MessageInfo(unwrapped, MessageInfo.Type.OUTPUT, outputMessage.getName());

            if (outputEl != null && outputEl.getSchemaType() instanceof XmlSchemaComplexType) {
                xsct = (XmlSchemaComplexType)outputEl.getSchemaType();
                if (xsct.isAbstract()) {
                    passedRule = false;
View Full Code Here

TOP

Related Classes of org.apache.cxf.service.model.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.