Java Code Examples for org.apache.cxf.service.model.MessageInfo#getMessageParts()

The following examples show how to use org.apache.cxf.service.model.MessageInfo#getMessageParts() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ParameterProcessor.java    From cxf with Apache License 2.0 6 votes vote down vote up
private void processInput(JavaMethod method, MessageInfo inputMessage) throws ToolException {
    if (requireOutOfBandHeader()) {
        try {
            Class.forName("org.apache.cxf.binding.soap.SoapBindingFactory");
        } catch (Exception e) {
            LOG.log(Level.WARNING, new Message("SOAP_MISSING", LOG).toString());
        }
    }

    JAXWSBinding mBinding = inputMessage.getOperation().getExtensor(JAXWSBinding.class);
    for (MessagePartInfo part : inputMessage.getMessageParts()) {
        if (isOutOfBandHeader(part) && !requireOutOfBandHeader()) {
            continue;
        }
        JavaParameter param = getParameterFromPart(method, part, JavaType.Style.IN);
        if (mBinding != null && mBinding.getJaxwsParas() != null) {
            for (JAXWSParameter jwp : mBinding.getJaxwsParas()) {
                if (part.getName().getLocalPart().equals(jwp.getPart())) {
                    param.setName(jwp.getName());
                }
            }
        }
        addParameter(part, method, param);
    }
}
 
Example 2
Source File: ParameterProcessor.java    From cxf with Apache License 2.0 6 votes vote down vote up
private void processWrappedOutput(JavaMethod method,
                                  MessageInfo inputMessage,
                                  MessageInfo outputMessage) throws ToolException {

    processWrappedAbstractOutput(method, inputMessage, outputMessage);

    // process out of band headers
    if (countOutOfBandHeader(outputMessage) > 0) {
        for (MessagePartInfo hpart : outputMessage.getMessageParts()) {
            if (!isOutOfBandHeader(hpart) || !requireOutOfBandHeader()) {
                continue;
            }
            addParameter(hpart, method, getParameterFromPart(method, hpart, JavaType.Style.OUT));
        }
    }
}
 
Example 3
Source File: ColocUtil.java    From cxf with Apache License 2.0 6 votes vote down vote up
public static boolean isSameMessageInfo(MessageInfo mi1, MessageInfo mi2) {
    if ((mi1 == null && mi2 != null)
        || (mi1 != null && mi2 == null)) {
        return false;
    }

    if (mi1 != null && mi2 != null) {
        List<MessagePartInfo> mpil1 = mi1.getMessageParts();
        List<MessagePartInfo> mpil2 = mi2.getMessageParts();
        if (mpil1.size() != mpil2.size()) {
            return false;
        }
        int idx = 0;
        for (MessagePartInfo mpi1 : mpil1) {
            MessagePartInfo mpi2 = mpil2.get(idx);
            if (!mpi1.getTypeClass().equals(mpi2.getTypeClass())) {
                return false;
            }
            ++idx;
        }
    }
    return true;
}
 
Example 4
Source File: SoapBindingFactory.java    From cxf with Apache License 2.0 6 votes vote down vote up
private void setupHeaders(BindingOperationInfo op,
                          BindingMessageInfo bMsg,
                          BindingMessageInfo unwrappedBMsg,
                          MessageInfo msg,
                          SoapBindingConfiguration config) {
    List<MessagePartInfo> parts = new ArrayList<>();
    for (MessagePartInfo part : msg.getMessageParts()) {
        if (config.isHeader(op, part)) {
            SoapHeaderInfo headerInfo = new SoapHeaderInfo();
            headerInfo.setPart(part);
            headerInfo.setUse(config.getUse());

            bMsg.addExtensor(headerInfo);
        } else {
            parts.add(part);
        }
    }
    unwrappedBMsg.setMessageParts(parts);
}
 
Example 5
Source File: RequestWrapper.java    From cxf with Apache License 2.0 5 votes vote down vote up
protected List<JavaField> buildFields(final Method method, final MessageInfo message) {
    List<JavaField> fields = new ArrayList<>();

    final Type[] paramClasses = method.getGenericParameterTypes();
    final Annotation[][] paramAnnotations = method.getParameterAnnotations();

    for (MessagePartInfo mpi : message.getMessageParts()) {
        int idx = mpi.getIndex();
        String name = mpi.getName().getLocalPart();
        Type t = paramClasses[idx];
        String type = getTypeString(t);

        JavaField field = new JavaField(name, type, "");

        if (paramAnnotations != null
            && paramAnnotations.length == paramClasses.length) {
            WebParam wParam = getWebParamAnnotation(paramAnnotations[idx]);
            if (wParam != null && !StringUtils.isEmpty(wParam.targetNamespace())) {
                field.setTargetNamespace(wParam.targetNamespace());
            } else {
                field.setTargetNamespace("");
            }
        }

        List<Annotation> jaxbAnns = WrapperUtil.getJaxbAnnotations(method, idx);
        field.setJaxbAnnotations(jaxbAnns.toArray(new Annotation[0]));
        fields.add(field);
    }

    return fields;
}
 
Example 6
Source File: ParameterProcessor.java    From cxf with Apache License 2.0 5 votes vote down vote up
private int countOutOfBandHeader(MessageInfo message) {
    int count = 0;
    for (MessagePartInfo part : message.getMessageParts()) {
        if (isOutOfBandHeader(part)) {
            count++;
        }
    }
    return count;
}
 
Example 7
Source File: ParameterProcessor.java    From cxf with Apache License 2.0 5 votes vote down vote up
private void processWrappedInput(JavaMethod method, MessageInfo inputMessage) throws ToolException {
    if (messagePartsNotUnique(inputMessage)) {
        processInput(method, inputMessage);
        return;
    } else if (inputMessage.getMessagePartsNumber() == 0) {
        return;
    }
    MessagePartInfo part = inputMessage.getFirstMessagePart();

    List<QName> wrappedElements = ProcessorUtil.getWrappedElementQNames(context, part.getElementQName());
    if ((wrappedElements == null || wrappedElements.isEmpty())
        && countOutOfBandHeader(inputMessage) == 0) {
        return;
    }
    for (QName item : wrappedElements) {
        JavaParameter jp = getParameterFromQName(part.getElementQName(),
                              item, JavaType.Style.IN, part);

        checkPartName(inputMessage, item, jp);

        if (StringUtils.isEmpty(part.getConcreteName().getNamespaceURI())) {
            jp.setTargetNamespace("");
        }

        addParameter(part, method, jp);
    }

    // Adding out of band headers
    if (requireOutOfBandHeader() && countOutOfBandHeader(inputMessage) > 0) {
        for (MessagePartInfo hpart : inputMessage.getMessageParts()) {
            if (!isOutOfBandHeader(hpart)) {
                continue;
            }
            addParameter(hpart, method, getParameterFromPart(method, hpart, JavaType.Style.IN));
        }
    }
}
 
Example 8
Source File: JAXBDataBinding.java    From cxf with Apache License 2.0 5 votes vote down vote up
private void justCheckForJAXBAnnotations(ServiceInfo serviceInfo) {
    for (MessageInfo mi: serviceInfo.getMessages().values()) {
        for (MessagePartInfo mpi : mi.getMessageParts()) {
            checkForJAXBAnnotations(mpi, serviceInfo.getXmlSchemaCollection(), serviceInfo.getTargetNamespace());
        }
    }
}
 
Example 9
Source File: XMLBindingFactory.java    From cxf with Apache License 2.0 5 votes vote down vote up
private void adjustConcreteNames(MessageInfo mi) {
    if (mi != null) {
        for (MessagePartInfo mpi : mi.getMessageParts()) {
            if (!mpi.isElement()) {
                //if it's not an element, we need to make it one
                mpi.setConcreteName(mpi.getName());
            }
        }
    }
}
 
Example 10
Source File: ParameterProcessor.java    From cxf with Apache License 2.0 4 votes vote down vote up
private void processOutput(JavaMethod method, MessageInfo inputMessage, MessageInfo outputMessage)
    throws ToolException {

    Map<QName, MessagePartInfo> inputPartsMap = inputMessage.getMessagePartsMap();
    List<MessagePartInfo> outputParts =
        outputMessage == null ? new ArrayList<>() : outputMessage.getMessageParts();
    // figure out output parts that are not present in input parts
    List<MessagePartInfo> outParts = new ArrayList<>();
    int numHeader = 0;
    if (isRequestResponse(method)) {
        for (MessagePartInfo outpart : outputParts) {
            boolean oob = false;
            if (isOutOfBandHeader(outpart)) {
                if (!requireOutOfBandHeader()) {
                    continue;
                }
                oob = true;
            }

            MessagePartInfo inpart = inputPartsMap.get(outpart.getName());
            if (inpart == null) {
                outParts.add(outpart);
                if (oob) {
                    numHeader++;
                }
                continue;
            } else if (isSamePart(inpart, outpart)) {
                boolean found = false;
                for (JavaParameter p : method.getParameters()) {
                    if (p.getQName().equals(ProcessorUtil.getElementName(outpart))
                        && p.getPartName().equals(outpart.getName().getLocalPart())) {
                        p.setHolder(true);
                        p.setHolderName(javax.xml.ws.Holder.class.getName());
                        String holderClass = p.getClassName();
                        if (JAXBUtils.holderClass(holderClass) != null) {
                            holderClass = JAXBUtils.holderClass(holderClass).getName();
                        }
                        p.setClassName(holderClass);
                        p.getAnnotations().clear();
                        p.setStyle(JavaType.Style.INOUT);
                        p.annotate(new WebParamAnnotator(isOutOfBandHeader(outpart)));
                        found = true;
                    }
                }
                if (!found) {
                    addParameter(outpart, method,
                                 getParameterFromPart(method, outpart, JavaType.Style.INOUT));
                }
                continue;
            } else if (!isSamePart(inpart, outpart)) {
                if (oob) {
                    numHeader++;
                }
                outParts.add(outpart);
                continue;
            }
        }
    }

    if (isRequestResponse(method)) {
        if (outParts.size() - numHeader == 1
            && !isHeader(outParts.get(0))) {
            processReturn(method, outParts.get(0));
            outParts.remove(0);
        } else {
            processReturn(method, null);
        }
        JAXWSBinding mBinding = outputMessage.getOperation().getExtensor(JAXWSBinding.class);
        for (MessagePartInfo part : outParts) {

            JavaParameter param = getParameterFromPart(method, part, JavaType.Style.OUT);
            if (mBinding != null && mBinding.getJaxwsParas() != null) {
                for (JAXWSParameter jwp : mBinding.getJaxwsParas()) {
                    if (part.getName().getLocalPart().equals(jwp.getPart())) {
                        param.setName(jwp.getName());
                    }
                }
            }

            addParameter(part, method, param);
        }
    } else {
        processReturn(method, null);
    }
}
 
Example 11
Source File: WrapperClassGenerator.java    From cxf with Apache License 2.0 4 votes vote down vote up
private void createWrapperClass(MessagePartInfo wrapperPart,
                                    MessageInfo messageInfo,
                                    OperationInfo op,
                                    Method method,
                                    boolean isRequest) {


    ClassWriter cw = createClassWriter();
    if (cw == null) {
        LOG.warning(op.getName() + " requires a wrapper bean but problems with"
            + " ASM has prevented creating one. Operation may not work correctly.");
        return;
    }
    QName wrapperElement = messageInfo.getName();
    boolean anonymous = factory.getAnonymousWrapperTypes();

    String pkg = getPackageName(method) + ".jaxws_asm" + (anonymous ? "_an" : "");
    String className = pkg + "."
        + StringUtils.capitalize(op.getName().getLocalPart());
    if (!isRequest) {
        className = className + "Response";
    }
    String pname = pkg + ".package-info";
    Class<?> def = findClass(pname, method.getDeclaringClass());
    if (def == null) {
        generatePackageInfo(pname, wrapperElement.getNamespaceURI(),
                            method.getDeclaringClass());
    }

    def = findClass(className, method.getDeclaringClass());
    String origClassName = className;
    int count = 0;
    while (def != null) {
        Boolean b = messageInfo.getProperty("parameterized", Boolean.class);
        if (b != null && b) {
            className = origClassName + (++count);
            def = findClass(className, method.getDeclaringClass());
        } else {
            wrapperPart.setTypeClass(def);
            wrapperBeans.add(def);
            return;
        }
    }
    String classFileName = periodToSlashes(className);
    cw.visit(Opcodes.V1_5, Opcodes.ACC_PUBLIC + Opcodes.ACC_SUPER, classFileName, null,
             "java/lang/Object", null);

    AnnotationVisitor av0 = cw.visitAnnotation("Ljavax/xml/bind/annotation/XmlRootElement;", true);
    av0.visit("name", wrapperElement.getLocalPart());
    av0.visit("namespace", wrapperElement.getNamespaceURI());
    av0.visitEnd();

    av0 = cw.visitAnnotation("Ljavax/xml/bind/annotation/XmlAccessorType;", true);
    av0.visitEnum("value", "Ljavax/xml/bind/annotation/XmlAccessType;", "FIELD");
    av0.visitEnd();

    av0 = cw.visitAnnotation("Ljavax/xml/bind/annotation/XmlType;", true);
    if (!anonymous) {
        av0.visit("name", wrapperElement.getLocalPart());
        av0.visit("namespace", wrapperElement.getNamespaceURI());
    } else {
        av0.visit("name", "");
    }
    av0.visitEnd();

    // add constructor
    MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "<init>", "()V", null, null);
    mv.visitCode();
    Label lbegin = createLabel();
    mv.visitLabel(lbegin);
    mv.visitVarInsn(Opcodes.ALOAD, 0);
    mv.visitMethodInsn(Opcodes.INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false);
    mv.visitInsn(Opcodes.RETURN);
    Label lend = createLabel();
    mv.visitLabel(lend);
    mv.visitLocalVariable("this", "L" + classFileName + ";", null, lbegin, lend, 0);
    mv.visitMaxs(1, 1);
    mv.visitEnd();

    for (MessagePartInfo mpi : messageInfo.getMessageParts()) {
        generateMessagePart(cw, mpi, method, classFileName);
    }

    cw.visitEnd();

    Class<?> clz = loadClass(className, method.getDeclaringClass(), cw.toByteArray());
    wrapperPart.setTypeClass(clz);
    wrapperBeans.add(clz);
}
 
Example 12
Source File: WrapperClassOutInterceptor.java    From cxf with Apache License 2.0 4 votes vote down vote up
public void handleMessage(Message message) throws Fault {
    Exchange ex = message.getExchange();
    BindingOperationInfo bop = ex.getBindingOperationInfo();

    MessageInfo messageInfo = message.get(MessageInfo.class);
    if (messageInfo == null || bop == null || !bop.isUnwrapped()) {
        return;
    }

    BindingOperationInfo newbop = bop.getWrappedOperation();
    MessageInfo wrappedMsgInfo;
    if (Boolean.TRUE.equals(message.get(Message.REQUESTOR_ROLE))) {
        wrappedMsgInfo = newbop.getInput().getMessageInfo();
    } else {
        wrappedMsgInfo = newbop.getOutput().getMessageInfo();
    }

    Class<?> wrapped = null;
    if (wrappedMsgInfo.getMessagePartsNumber() > 0) {
        wrapped = wrappedMsgInfo.getFirstMessagePart().getTypeClass();
    }

    if (wrapped != null) {
        MessagePartInfo firstMessagePart = wrappedMsgInfo.getFirstMessagePart();
        MessageContentsList objs = MessageContentsList.getContentsList(message);
        WrapperHelper helper = firstMessagePart.getProperty("WRAPPER_CLASS", WrapperHelper.class);
        if (helper == null) {
            helper = getWrapperHelper(message, messageInfo, wrappedMsgInfo, wrapped, firstMessagePart);
        }
        if (helper == null) {
            return;
        }

        try {
            MessageContentsList newObjs = new MessageContentsList();
            if (ServiceUtils.isSchemaValidationEnabled(SchemaValidationType.OUT, message)
                && helper instanceof AbstractWrapperHelper) {
                ((AbstractWrapperHelper)helper).setValidate(true);
            }
            Object o2 = helper.createWrapperObject(objs);
            newObjs.put(firstMessagePart, o2);

            for (MessagePartInfo p : messageInfo.getMessageParts()) {
                if (Boolean.TRUE.equals(p.getProperty(ReflectionServiceFactoryBean.HEADER))) {
                    MessagePartInfo mpi = wrappedMsgInfo.getMessagePart(p.getName());
                    if (objs.hasValue(p)) {
                        newObjs.put(mpi, objs.get(p));
                    }
                }
            }

            message.setContent(List.class, newObjs);
        } catch (Fault f) {
            throw f;
        } catch (Exception e) {
            throw new Fault(e);
        }

        // we've now wrapped the object, so use the wrapped binding op
        ex.put(BindingOperationInfo.class, newbop);

        if (messageInfo == bop.getOperationInfo().getInput()) {
            message.put(MessageInfo.class, newbop.getOperationInfo().getInput());
            message.put(BindingMessageInfo.class, newbop.getInput());
        } else if (messageInfo == bop.getOperationInfo().getOutput()) {
            message.put(MessageInfo.class, newbop.getOperationInfo().getOutput());
            message.put(BindingMessageInfo.class, newbop.getOutput());
        }
    }
}
 
Example 13
Source File: ColocUtil.java    From cxf with Apache License 2.0 4 votes vote down vote up
public static boolean isAssignableOperationInfo(OperationInfo oi, Class<?> cls) {
    MessageInfo mi = oi.getInput();
    List<MessagePartInfo> mpis = mi.getMessageParts();
    return mpis.size() == 1 && cls.isAssignableFrom(mpis.get(0).getTypeClass());
}
 
Example 14
Source File: ServiceJavascriptBuilder.java    From cxf with Apache License 2.0 4 votes vote down vote up
private void createResponseDeserializer(MessageInfo outputMessage) {
    List<MessagePartInfo> parts = outputMessage.getMessageParts();
    if (parts.size() != 1) {
        unsupportedConstruct("MULTIPLE_OUTPUTS", outputMessage.getName().toString());
    }
    List<ParticleInfo> elements = new ArrayList<>();
    String functionName = outputDeserializerFunctionName(outputMessage);
    code.append("function " + functionName + "(cxfjsutils, partElement) {\n");
    getElementsForParts(outputMessage, elements);
    ParticleInfo element = elements.get(0);
    XmlSchemaType type = null;

    if (isRPC) {
        utils.appendLine("cxfjsutils.trace('rpc element: ' + cxfjsutils.traceElementName(partElement));");
        utils.appendLine("partElement = cxfjsutils.getFirstElementChild(partElement);");
        utils.appendLine("cxfjsutils.trace('rpc element: ' + cxfjsutils.traceElementName(partElement));");
    }

    type = element.getType();

    if (!element.isEmpty()) {
        if (type instanceof XmlSchemaComplexType) {
            String typeObjectName = nameManager.getJavascriptName(element.getControllingName());
            utils
                .appendLine("var returnObject = "
                            + typeObjectName
                            + "_deserialize (cxfjsutils, partElement);\n");
            utils.appendLine("return returnObject;");
        } else if (type instanceof XmlSchemaSimpleType) {
            XmlSchemaSimpleType simpleType = (XmlSchemaSimpleType)type;
            utils.appendLine("var returnText = cxfjsutils.getNodeText(partElement);");
            utils.appendLine("var returnObject = "
                             + utils.javascriptParseExpression(simpleType, "returnText") + ";");
            utils.appendLine("return returnObject;");
        } else if (type != null) {
            utils.appendLine("// Unsupported construct " + type.getClass());
        } else {
            utils.appendLine("// No type for element " + element.getXmlName());
        }
    }
    code.append("}\n");
}
 
Example 15
Source File: ReflectionServiceFactoryBean.java    From cxf with Apache License 2.0 4 votes vote down vote up
protected void createBareMessage(ServiceInfo serviceInfo, OperationInfo opInfo, boolean isOut) {

        MessageInfo message = isOut ? opInfo.getOutput() : opInfo.getInput();

        final List<MessagePartInfo> messageParts = message.getMessageParts();
        if (messageParts.isEmpty()) {
            return;
        }

        Method method = (Method)opInfo.getProperty(METHOD);
        int paraNumber = 0;
        for (MessagePartInfo mpi : messageParts) {
            SchemaInfo schemaInfo = null;
            XmlSchema schema = null;

            QName qname = (QName)mpi.getProperty(ELEMENT_NAME);
            if (messageParts.size() == 1 && qname == null) {
                qname = !isOut ? getInParameterName(opInfo, method, -1)
                        : getOutParameterName(opInfo, method, -1);

                if (qname.getLocalPart().startsWith("arg") || qname.getLocalPart().startsWith("return")) {
                    qname = isOut
                        ? new QName(qname.getNamespaceURI(), method.getName() + "Response") : new QName(qname
                            .getNamespaceURI(), method.getName());
                }
            } else if (isOut && messageParts.size() > 1 && qname == null) {
                while (!isOutParam(method, paraNumber)) {
                    paraNumber++;
                }
                qname = getOutParameterName(opInfo, method, paraNumber);
            } else if (qname == null) {
                qname = getInParameterName(opInfo, method, paraNumber);
            }

            for (SchemaInfo s : serviceInfo.getSchemas()) {
                if (s.getNamespaceURI().equals(qname.getNamespaceURI())) {
                    schemaInfo = s;
                    break;
                }
            }

            if (schemaInfo == null) {
                schemaInfo = getOrCreateSchema(serviceInfo, qname.getNamespaceURI(), true);
                schema = schemaInfo.getSchema();
            } else {
                schema = schemaInfo.getSchema();
                if (schema != null && schema.getElementByName(qname) != null) {
                    mpi.setElement(true);
                    mpi.setElementQName(qname);
                    mpi.setXmlSchema(schema.getElementByName(qname));
                    paraNumber++;
                    continue;
                }
            }

            schemaInfo.setElement(null); //cached element is now invalid
            XmlSchemaElement el = new XmlSchemaElement(schema, true);
            el.setName(qname.getLocalPart());
            el.setNillable(true);

            if (mpi.isElement()) {
                XmlSchemaElement oldEl = (XmlSchemaElement)mpi.getXmlSchema();
                if (null != oldEl && !oldEl.getQName().equals(qname)) {
                    el.setSchemaTypeName(oldEl.getSchemaTypeName());
                    el.setSchemaType(oldEl.getSchemaType());
                    if (oldEl.getSchemaTypeName() != null) {
                        addImport(schema, oldEl.getSchemaTypeName().getNamespaceURI());
                    }
                }
                mpi.setElement(true);
                mpi.setXmlSchema(el);
                mpi.setElementQName(qname);
                mpi.setConcreteName(qname);
                continue;
            }
            if (null == mpi.getTypeQName() && mpi.getXmlSchema() == null) {
                throw new ServiceConstructionException(new Message("UNMAPPABLE_PORT_TYPE", LOG,
                                                                   method.getDeclaringClass().getName(),
                                                                   method.getName(),
                                                                   mpi.getName()));
            }
            if (mpi.getTypeQName() != null) {
                el.setSchemaTypeName(mpi.getTypeQName());
            } else {
                el.setSchemaType((XmlSchemaType)mpi.getXmlSchema());
            }
            mpi.setXmlSchema(el);
            mpi.setConcreteName(qname);
            if (mpi.getTypeQName() != null) {
                addImport(schema, mpi.getTypeQName().getNamespaceURI());
            }

            mpi.setElement(true);
            mpi.setElementQName(qname);
            paraNumber++;
        }
    }
 
Example 16
Source File: DocLiteralInInterceptorTest.java    From cxf with Apache License 2.0 4 votes vote down vote up
@Test
public void testUnmarshalSourceData() throws Exception {
    XMLStreamReader reader = StaxUtils.createXMLStreamReader(getClass()
        .getResourceAsStream("resources/multiPartDocLitBareReq.xml"));

    assertEquals(XMLStreamConstants.START_ELEMENT, reader.nextTag());

    XMLStreamReader filteredReader = new PartialXMLStreamReader(reader,
         new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body"));

    // advance the xml reader to the message parts
    StaxUtils.read(filteredReader);
    assertEquals(XMLStreamConstants.START_ELEMENT, reader.nextTag());

    Message m = new MessageImpl();
    Exchange exchange = new ExchangeImpl();

    Service service = control.createMock(Service.class);
    exchange.put(Service.class, service);
    EasyMock.expect(service.getDataBinding()).andReturn(new SourceDataBinding());
    EasyMock.expect(service.size()).andReturn(0).anyTimes();
    EasyMock.expect(service.isEmpty()).andReturn(true).anyTimes();

    Endpoint endpoint = control.createMock(Endpoint.class);
    exchange.put(Endpoint.class, endpoint);

    OperationInfo operationInfo = new OperationInfo();
    operationInfo.setProperty("operation.is.synthetic", Boolean.TRUE);
    MessageInfo messageInfo = new MessageInfo(operationInfo, Type.INPUT,
                                              new QName("http://foo.com", "bar"));
    messageInfo.addMessagePart(new MessagePartInfo(new QName("http://foo.com", "partInfo1"), null));
    messageInfo.addMessagePart(new MessagePartInfo(new QName("http://foo.com", "partInfo2"), null));
    messageInfo.addMessagePart(new MessagePartInfo(new QName("http://foo.com", "partInfo3"), null));
    messageInfo.addMessagePart(new MessagePartInfo(new QName("http://foo.com", "partInfo4"), null));

    for (MessagePartInfo mpi : messageInfo.getMessageParts()) {
        mpi.setMessageContainer(messageInfo);
    }

    operationInfo.setInput("inputName", messageInfo);

    BindingOperationInfo boi = new BindingOperationInfo(null, operationInfo);
    exchange.put(BindingOperationInfo.class, boi);

    EndpointInfo endpointInfo = control.createMock(EndpointInfo.class);
    BindingInfo binding = control.createMock(BindingInfo.class);
    EasyMock.expect(endpoint.getEndpointInfo()).andReturn(endpointInfo).anyTimes();
    EasyMock.expect(endpointInfo.getBinding()).andReturn(binding).anyTimes();
    EasyMock.expect(binding.getProperties()).andReturn(new HashMap<String, Object>()).anyTimes();
    EasyMock.expect(endpointInfo.getProperties()).andReturn(new HashMap<String, Object>()).anyTimes();
    EasyMock.expect(endpoint.size()).andReturn(0).anyTimes();
    EasyMock.expect(endpoint.isEmpty()).andReturn(true).anyTimes();

    ServiceInfo serviceInfo = control.createMock(ServiceInfo.class);
    EasyMock.expect(endpointInfo.getService()).andReturn(serviceInfo).anyTimes();

    EasyMock.expect(serviceInfo.getName()).andReturn(new QName("http://foo.com", "service")).anyTimes();
    InterfaceInfo interfaceInfo = control.createMock(InterfaceInfo.class);
    EasyMock.expect(serviceInfo.getInterface()).andReturn(interfaceInfo).anyTimes();
    EasyMock.expect(interfaceInfo.getName())
        .andReturn(new QName("http://foo.com", "interface")).anyTimes();

    EasyMock.expect(endpointInfo.getName()).andReturn(new QName("http://foo.com", "endpoint")).anyTimes();
    EasyMock.expect(endpointInfo.getProperty("URI", URI.class)).andReturn(new URI("dummy")).anyTimes();

    List<OperationInfo> operations = new ArrayList<>();
    EasyMock.expect(interfaceInfo.getOperations()).andReturn(operations).anyTimes();

    m.setExchange(exchange);
    m.put(Message.SCHEMA_VALIDATION_ENABLED, false);
    m.setContent(XMLStreamReader.class, reader);

    control.replay();

    new DocLiteralInInterceptor().handleMessage(m);

    MessageContentsList params = (MessageContentsList)m.getContent(List.class);

    assertEquals(4, params.size());
    assertEquals("StringDefaultInputElem",
                 ((DOMSource)params.get(0)).getNode().getFirstChild().getNodeName());
    assertEquals("IntParamInElem",
                 ((DOMSource)params.get(1)).getNode().getFirstChild().getNodeName());
}