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

The following examples show how to use org.apache.cxf.service.model.MessageInfo. 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: ServiceJavascriptBuilder.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Override
public void begin(MessageInfo msg) {
    if (isInUnwrappedOperation) {
        return;
    }
    LOG.fine("Message " + msg.getName().toString());
    Map<String, MessageInfo> nameMap;
    Set<MessageInfo> conflicts;
    if (msg.getType() == MessageInfo.Type.INPUT) {
        nameMap = localInputMessagesNameMap;
        conflicts = inputMessagesWithNameConflicts;
    } else {
        nameMap = localOutputMessagesNameMap;
        conflicts = outputMessagesWithNameConflicts;

    }
    MessageInfo conflict = nameMap.get(msg.getName().getLocalPart());
    if (conflict != null) {
        conflicts.add(conflict);
        conflicts.add(msg);
    }
    nameMap.put(msg.getName().getLocalPart(), msg);
}
 
Example #2
Source File: STSUtils.java    From steady with Apache License 2.0 6 votes vote down vote up
private static OperationInfo addCancelOperation(InterfaceInfo ii, 
                                                String namespace,
                                                String servNamespace) {
    OperationInfo oi = ii.addOperation(new QName(servNamespace, "CancelSecurityToken"));
    MessageInfo mii = oi.createMessage(new QName(servNamespace, "CancelSecurityTokenMsg"), 
                                       MessageInfo.Type.INPUT);
    oi.setInput("CancelSecurityTokenMsg", mii);
    MessagePartInfo mpi = mii.addMessagePart("request");
    mpi.setElementQName(new QName(namespace, "CancelSecurityToken"));
    
    MessageInfo mio = oi.createMessage(new QName(servNamespace, 
                                                 "CancelSecurityTokenResponseMsg"), 
                                       MessageInfo.Type.OUTPUT);
    oi.setOutput("CancelSecurityTokenResponseMsg", mio);
    mpi = mio.addMessagePart("response");
    mpi.setElementQName(new QName(namespace, "CancelSecurityTokenResponse"));
    return oi;
}
 
Example #3
Source File: ParameterProcessor.java    From cxf with Apache License 2.0 6 votes vote down vote up
public void process(JavaMethod method,
                    MessageInfo inputMessage,
                    MessageInfo outputMessage,
                    List<String> parameterOrder) throws ToolException {

    if (!StringUtils.isEmpty(parameterOrder)
        && isValidOrdering(parameterOrder, inputMessage, outputMessage)
        && !method.isWrapperStyle()) {

        buildParamModelsWithOrdering(method,
                                     inputMessage,
                                     outputMessage,
                                     parameterOrder);
    } else {
        buildParamModelsWithoutOrdering(method,
                                        inputMessage,
                                        outputMessage);
    }
}
 
Example #4
Source File: STSUtils.java    From steady with Apache License 2.0 6 votes vote down vote up
private static OperationInfo addIssueOperation(InterfaceInfo ii, 
                                               String namespace,
                                               String servNamespace) {
    OperationInfo oi = ii.addOperation(new QName(servNamespace, "RequestSecurityToken"));
    MessageInfo mii = oi.createMessage(new QName(servNamespace, "RequestSecurityTokenMsg"), 
                                       MessageInfo.Type.INPUT);
    oi.setInput("RequestSecurityTokenMsg", mii);
    MessagePartInfo mpi = mii.addMessagePart("request");
    mpi.setElementQName(new QName(namespace, "RequestSecurityToken"));
    
    MessageInfo mio = oi.createMessage(new QName(servNamespace, 
        "RequestSecurityTokenResponseMsg"), 
        MessageInfo.Type.OUTPUT);
    oi.setOutput("RequestSecurityTokenResponseMsg", mio);
    mpi = mio.addMessagePart("response");
    
    if (WST_NS_05_02.equals(namespace)) {
        mpi.setElementQName(new QName(namespace, "RequestSecurityTokenResponse"));
    } else {
        mpi.setElementQName(new QName(namespace, "RequestSecurityTokenResponseCollection"));
    }
    return oi;
}
 
Example #5
Source File: STSUtils.java    From steady with Apache License 2.0 6 votes vote down vote up
private static OperationInfo addIssueOperation(InterfaceInfo ii, 
                                               String namespace,
                                               String servNamespace) {
    OperationInfo oi = ii.addOperation(new QName(servNamespace, "RequestSecurityToken"));
    MessageInfo mii = oi.createMessage(new QName(servNamespace, "RequestSecurityTokenMsg"), 
                                       MessageInfo.Type.INPUT);
    oi.setInput("RequestSecurityTokenMsg", mii);
    MessagePartInfo mpi = mii.addMessagePart("request");
    mpi.setElementQName(new QName(namespace, "RequestSecurityToken"));
    
    MessageInfo mio = oi.createMessage(new QName(servNamespace, 
        "RequestSecurityTokenResponseMsg"), 
        MessageInfo.Type.OUTPUT);
    oi.setOutput("RequestSecurityTokenResponseMsg", mio);
    mpi = mio.addMessagePart("response");
    
    if (WST_NS_05_02.equals(namespace)) {
        mpi.setElementQName(new QName(namespace, "RequestSecurityTokenResponse"));
    } else {
        mpi.setElementQName(new QName(namespace, "RequestSecurityTokenResponseCollection"));
    }
    return oi;
}
 
Example #6
Source File: STSUtils.java    From steady with Apache License 2.0 6 votes vote down vote up
private static OperationInfo addCancelOperation(InterfaceInfo ii, 
                                                String namespace,
                                                String servNamespace) {
    OperationInfo oi = ii.addOperation(new QName(servNamespace, "CancelSecurityToken"));
    MessageInfo mii = oi.createMessage(new QName(servNamespace, "CancelSecurityTokenMsg"), 
                                       MessageInfo.Type.INPUT);
    oi.setInput("CancelSecurityTokenMsg", mii);
    MessagePartInfo mpi = mii.addMessagePart("request");
    mpi.setElementQName(new QName(namespace, "CancelSecurityToken"));
    
    MessageInfo mio = oi.createMessage(new QName(servNamespace, 
                                                 "CancelSecurityTokenResponseMsg"), 
                                       MessageInfo.Type.OUTPUT);
    oi.setOutput("CancelSecurityTokenResponseMsg", mio);
    mpi = mio.addMessagePart("response");
    mpi.setElementQName(new QName(namespace, "CancelSecurityTokenResponse"));
    return oi;
}
 
Example #7
Source File: JavaFirstUriDomainExpression.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Override
public boolean appliesTo(BindingMessageInfo bmi) {
    String serviceName =
        bmi.getBindingOperation().getBinding().getService().getName().getLocalPart();

    if ("JavaFirstAttachmentPolicyService".equals(serviceName) && "usernamepassword".equals(url)) {
        return ("doInputMessagePolicy".equals(bmi.getBindingOperation().getName().getLocalPart())
            && MessageInfo.Type.INPUT.equals(bmi.getMessageInfo().getType()))
            || ("doOutputMessagePolicy".equals(bmi.getBindingOperation().getName().getLocalPart())
            && MessageInfo.Type.OUTPUT.equals(bmi.getMessageInfo().getType()));
    } else if ("SslUsernamePasswordAttachmentService".equals(serviceName)
        && "sslusernamepassword".equals(url)) {
        return MessageInfo.Type.INPUT.equals(bmi.getMessageInfo().getType());
    } else {
        return false;
    }
}
 
Example #8
Source File: STSUtils.java    From steady with Apache License 2.0 6 votes vote down vote up
private static OperationInfo addIssueOperation(InterfaceInfo ii, 
                                               String namespace,
                                               String servNamespace) {
    OperationInfo oi = ii.addOperation(new QName(servNamespace, "RequestSecurityToken"));
    MessageInfo mii = oi.createMessage(new QName(servNamespace, "RequestSecurityTokenMsg"), 
                                       MessageInfo.Type.INPUT);
    oi.setInput("RequestSecurityTokenMsg", mii);
    MessagePartInfo mpi = mii.addMessagePart("request");
    mpi.setElementQName(new QName(namespace, "RequestSecurityToken"));
    
    MessageInfo mio = oi.createMessage(new QName(servNamespace, 
        "RequestSecurityTokenResponseMsg"), 
        MessageInfo.Type.OUTPUT);
    oi.setOutput("RequestSecurityTokenResponseMsg", mio);
    mpi = mio.addMessagePart("response");
    
    if (WST_NS_05_02.equals(namespace)) {
        mpi.setElementQName(new QName(namespace, "RequestSecurityTokenResponse"));
    } else {
        mpi.setElementQName(new QName(namespace, "RequestSecurityTokenResponseCollection"));
    }
    return oi;
}
 
Example #9
Source File: STSUtils.java    From steady with Apache License 2.0 6 votes vote down vote up
private static OperationInfo addCancelOperation(InterfaceInfo ii, 
                                                String namespace,
                                                String servNamespace) {
    OperationInfo oi = ii.addOperation(new QName(servNamespace, "CancelSecurityToken"));
    MessageInfo mii = oi.createMessage(new QName(servNamespace, "CancelSecurityTokenMsg"), 
                                       MessageInfo.Type.INPUT);
    oi.setInput("CancelSecurityTokenMsg", mii);
    MessagePartInfo mpi = mii.addMessagePart("request");
    mpi.setElementQName(new QName(namespace, "CancelSecurityToken"));
    
    MessageInfo mio = oi.createMessage(new QName(servNamespace, 
                                                 "CancelSecurityTokenResponseMsg"), 
                                       MessageInfo.Type.OUTPUT);
    oi.setOutput("CancelSecurityTokenResponseMsg", mio);
    mpi = mio.addMessagePart("response");
    mpi.setElementQName(new QName(namespace, "CancelSecurityTokenResponse"));
    return oi;
}
 
Example #10
Source File: STSUtils.java    From steady with Apache License 2.0 6 votes vote down vote up
private static OperationInfo addIssueOperation(InterfaceInfo ii, 
                                               String namespace,
                                               String servNamespace) {
    OperationInfo oi = ii.addOperation(new QName(servNamespace, "RequestSecurityToken"));
    MessageInfo mii = oi.createMessage(new QName(servNamespace, "RequestSecurityTokenMsg"), 
                                       MessageInfo.Type.INPUT);
    oi.setInput("RequestSecurityTokenMsg", mii);
    MessagePartInfo mpi = mii.addMessagePart("request");
    mpi.setElementQName(new QName(namespace, "RequestSecurityToken"));
    
    MessageInfo mio = oi.createMessage(new QName(servNamespace, 
        "RequestSecurityTokenResponseMsg"), 
        MessageInfo.Type.OUTPUT);
    oi.setOutput("RequestSecurityTokenResponseMsg", mio);
    mpi = mio.addMessagePart("response");
    
    if (WST_NS_05_02.equals(namespace)) {
        mpi.setElementQName(new QName(namespace, "RequestSecurityTokenResponse"));
    } else {
        mpi.setElementQName(new QName(namespace, "RequestSecurityTokenResponseCollection"));
    }
    return oi;
}
 
Example #11
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 #12
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 #13
Source File: JaxWsServiceConfigurationTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testGetInPartName() throws Exception {
    QName opName = new QName("http://cxf.com/", "sayHello");
    Method sayHelloMethod = Hello.class.getMethod("sayHello", new Class[]{String.class, String.class});
    ServiceInfo si = getMockedServiceModel("/wsdl/default_partname_test.wsdl");
    JaxWsServiceFactoryBean bean = new JaxWsServiceFactoryBean();
    bean.setServiceClass(Hello.class);
    JaxWsServiceConfiguration jwsc = (JaxWsServiceConfiguration) bean.getServiceConfigurations().get(0);
    jwsc.setServiceFactory(bean);

    OperationInfo op = si.getInterface().getOperation(opName);
    op.setInput("input", new MessageInfo(op, MessageInfo.Type.INPUT,
                                         new QName("http://cxf.com/", "input")));
    op.setOutput("output", new MessageInfo(op, MessageInfo.Type.OUTPUT,
                                           new QName("http://cxf.com/", "output")));

    QName partName = jwsc.getInPartName(op, sayHelloMethod, 0);
    assertEquals("get wrong in partName for first param", new QName("http://cxf.com/", "arg0"), partName);

    op.getInput().addMessagePart(new QName("arg0"));

    partName = jwsc.getInPartName(op, sayHelloMethod, 1);
    assertEquals("get wrong in partName for first param", new QName("http://cxf.com/", "arg1"), partName);
}
 
Example #14
Source File: STSUtils.java    From steady with Apache License 2.0 6 votes vote down vote up
private static OperationInfo addCancelOperation(InterfaceInfo ii, 
                                                String namespace,
                                                String servNamespace) {
    OperationInfo oi = ii.addOperation(new QName(servNamespace, "CancelSecurityToken"));
    MessageInfo mii = oi.createMessage(new QName(servNamespace, "CancelSecurityTokenMsg"), 
                                       MessageInfo.Type.INPUT);
    oi.setInput("CancelSecurityTokenMsg", mii);
    MessagePartInfo mpi = mii.addMessagePart("request");
    mpi.setElementQName(new QName(namespace, "CancelSecurityToken"));
    
    MessageInfo mio = oi.createMessage(new QName(servNamespace, 
                                                 "CancelSecurityTokenResponseMsg"), 
                                       MessageInfo.Type.OUTPUT);
    oi.setOutput("CancelSecurityTokenResponseMsg", mio);
    mpi = mio.addMessagePart("response");
    mpi.setElementQName(new QName(namespace, "CancelSecurityTokenResponse"));
    return oi;
}
 
Example #15
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 #16
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 #17
Source File: RMEndpoint.java    From cxf with Apache License 2.0 6 votes vote down vote up
void buildCloseSequenceOperationInfo(InterfaceInfo ii, ProtocolVariation protocol) {

        OperationInfo operationInfo = null;
        MessageInfo messageInfo = null;

        RMConstants consts = protocol.getConstants();
        operationInfo = ii.addOperation(consts.getCloseSequenceOperationName());
        messageInfo = operationInfo.createMessage(consts.getCloseSequenceOperationName(),
                                                  MessageInfo.Type.INPUT);
        operationInfo.setInput(messageInfo.getName().getLocalPart(), messageInfo);
        if (RM11Constants.NAMESPACE_URI.equals(protocol.getWSRMNamespace())) {
            MessagePartInfo partInfo = messageInfo.addMessagePart(CLOSE_PART_NAME);
            partInfo.setElementQName(consts.getCloseSequenceOperationName());
            partInfo.setElement(true);
            partInfo.setTypeClass(CloseSequenceType.class);
            messageInfo = operationInfo.createMessage(
                RM11Constants.INSTANCE.getCloseSequenceResponseOperationName(),
                MessageInfo.Type.OUTPUT);
            operationInfo.setOutput(messageInfo.getName().getLocalPart(), messageInfo);
            partInfo = messageInfo.addMessagePart(CLOSE_RESPONSE_PART_NAME);
            partInfo.setElementQName(RM11Constants.INSTANCE.getCloseSequenceResponseOperationName());
            partInfo.setElement(true);
            partInfo.setTypeClass(CloseSequenceResponseType.class);
            partInfo.setIndex(0);
        }
    }
 
Example #18
Source File: STSUtils.java    From cxf with Apache License 2.0 6 votes vote down vote up
private static OperationInfo addRenewOperation(InterfaceInfo ii,
                                               String namespace,
                                               String servNamespace) {
    OperationInfo oi = ii.addOperation(new QName(servNamespace, "RenewSecurityToken"));
    MessageInfo mii = oi.createMessage(new QName(servNamespace, "RenewSecurityTokenMsg"),
            MessageInfo.Type.INPUT);
    oi.setInput("RenewSecurityTokenMsg", mii);
    MessagePartInfo mpi = mii.addMessagePart("request");
    mpi.setElementQName(new QName(namespace, "RequestSecurityToken"));

    MessageInfo mio = oi.createMessage(new QName(servNamespace,
                    "RenewSecurityTokenResponseMsg"),
            MessageInfo.Type.OUTPUT);
    oi.setOutput("RenewSecurityTokenResponseMsg", mio);
    mpi = mio.addMessagePart("response");

    if (WST_NS_05_02.equals(namespace)) {
        mpi.setElementQName(new QName(namespace, "RequestSecurityTokenResponse"));
    } else {
        mpi.setElementQName(new QName(namespace, "RequestSecurityTokenResponseCollection"));
    }
    return oi;
}
 
Example #19
Source File: STSUtils.java    From cxf with Apache License 2.0 6 votes vote down vote up
private static OperationInfo addCancelOperation(InterfaceInfo ii,
                                                String namespace,
                                                String servNamespace) {
    OperationInfo oi = ii.addOperation(new QName(servNamespace, "CancelSecurityToken"));
    MessageInfo mii = oi.createMessage(new QName(servNamespace, "CancelSecurityTokenMsg"),
                                       MessageInfo.Type.INPUT);
    oi.setInput("CancelSecurityTokenMsg", mii);
    MessagePartInfo mpi = mii.addMessagePart("request");
    mpi.setElementQName(new QName(namespace, "RequestSecurityToken"));

    MessageInfo mio = oi.createMessage(new QName(servNamespace,
                                                 "CancelSecurityTokenResponseMsg"),
                                       MessageInfo.Type.OUTPUT);
    oi.setOutput("CancelSecurityTokenResponseMsg", mio);
    mpi = mio.addMessagePart("response");

    if (WST_NS_05_02.equals(namespace)) {
        mpi.setElementQName(new QName(namespace, "RequestSecurityTokenResponse"));
    } else {
        mpi.setElementQName(new QName(namespace, "RequestSecurityTokenResponseCollection"));
    }
    return oi;
}
 
Example #20
Source File: STSUtils.java    From cxf with Apache License 2.0 6 votes vote down vote up
private static OperationInfo addIssueOperation(InterfaceInfo ii,
                                               String namespace,
                                               String servNamespace) {
    OperationInfo oi = ii.addOperation(new QName(servNamespace, "RequestSecurityToken"));
    MessageInfo mii = oi.createMessage(new QName(servNamespace, "RequestSecurityTokenMsg"),
                                       MessageInfo.Type.INPUT);
    oi.setInput("RequestSecurityTokenMsg", mii);
    MessagePartInfo mpi = mii.addMessagePart("request");
    mpi.setElementQName(new QName(namespace, "RequestSecurityToken"));

    MessageInfo mio = oi.createMessage(new QName(servNamespace,
        "RequestSecurityTokenResponseMsg"),
        MessageInfo.Type.OUTPUT);
    oi.setOutput("RequestSecurityTokenResponseMsg", mio);
    mpi = mio.addMessagePart("response");

    if (WST_NS_05_02.equals(namespace)) {
        mpi.setElementQName(new QName(namespace, "RequestSecurityTokenResponse"));
    } else {
        mpi.setElementQName(new QName(namespace, "RequestSecurityTokenResponseCollection"));
    }
    return oi;
}
 
Example #21
Source File: JAXRSServiceImpl.java    From cxf with Apache License 2.0 6 votes vote down vote up
private void createMessagePartInfo(OperationInfo oi, Class<?> type, QName qname, Method m,
                                   boolean input) {
    if (type == void.class || Source.class.isAssignableFrom(type)) {
        return;
    }
    if (InjectionUtils.isPrimitive(type) || Response.class == type) {
        return;
    }
    QName mName = new QName(qname.getNamespaceURI(),
                            (input ? "in" : "out") + m.getName());
    MessageInfo ms = oi.createMessage(mName,
                                       input ? MessageInfo.Type.INPUT : MessageInfo.Type.OUTPUT);
    if (input) {
        oi.setInput("in", ms);
    } else {
        oi.setOutput("out", ms);
    }
    QName mpQName = JAXRSUtils.getClassQName(type);
    MessagePartInfo mpi = ms.addMessagePart(mpQName);
    mpi.setConcreteName(mpQName);
    mpi.setTypeQName(mpQName);
    mpi.setTypeClass(type);
}
 
Example #22
Source File: JaxWsServiceFactoryBeanTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testDocLiteralPartWithType() throws Exception {
    ReflectionServiceFactoryBean serviceFactory = new JaxWsServiceFactoryBean();
    serviceFactory.setBus(getBus());
    serviceFactory.setServiceClass(NoBodyPartsImpl.class);
    Service service = serviceFactory.create();
    ServiceInfo serviceInfo =
        service.getServiceInfos().get(0);
    QName qname = new QName("urn:org:apache:cxf:no_body_parts/wsdl",
                            "operation1");
    MessageInfo mi = serviceInfo.getMessage(qname);
    qname = new QName("urn:org:apache:cxf:no_body_parts/wsdl",
        "mimeAttachment");
    MessagePartInfo mpi = mi.getMessagePart(qname);
    QName elementQName = mpi.getElementQName();
    XmlSchemaElement element =
        serviceInfo.getXmlSchemaCollection().getElementByQName(elementQName);
    assertNotNull(element);
}
 
Example #23
Source File: JaxWsServiceConfigurationTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testGetOutPartName() throws Exception {
    QName opName = new QName("http://cxf.com/", "sayHi");
    Method sayHiMethod = Hello.class.getMethod("sayHi", new Class[]{});
    ServiceInfo si = getMockedServiceModel("/wsdl/default_partname_test.wsdl");
    JaxWsServiceConfiguration jwsc = new JaxWsServiceConfiguration();
    JaxWsServiceFactoryBean bean = new JaxWsServiceFactoryBean();
    bean.setServiceClass(Hello.class);
    jwsc.setServiceFactory(bean);

    // clear the output
    OperationInfo op = si.getInterface().getOperation(opName);
    op.setOutput("output", new MessageInfo(op,
                                           MessageInfo.Type.OUTPUT,
                                           new QName("http://cxf.com/", "output")));

    QName partName = jwsc.getOutPartName(op, sayHiMethod, -1);
    assertEquals("get wrong return partName", new QName("http://cxf.com/", "return"), partName);
}
 
Example #24
Source File: WrapperClassOutInterceptor.java    From cxf with Apache License 2.0 6 votes vote down vote up
private synchronized WrapperHelper getWrapperHelper(Message message,
                                       MessageInfo messageInfo,
                                       MessageInfo wrappedMessageInfo,
                                       Class<?> wrapClass,
                                       MessagePartInfo messagePartInfo) {
    WrapperHelper helper = messagePartInfo.getProperty("WRAPPER_CLASS", WrapperHelper.class);
    if (helper == null) {
        Service service = ServiceModelUtil.getService(message.getExchange());
        DataBinding dataBinding = service.getDataBinding();
        if (dataBinding instanceof WrapperCapableDatabinding) {
            helper = createWrapperHelper((WrapperCapableDatabinding)dataBinding,
                                         messageInfo, wrappedMessageInfo, wrapClass);
            messagePartInfo.setProperty("WRAPPER_CLASS", helper);
        }
    }
    return helper;
}
 
Example #25
Source File: MAPAggregatorImpl.java    From cxf with Apache License 2.0 5 votes vote down vote up
private String getActionFromOutputMessage(final OperationInfo operation) {
    MessageInfo outputMessage = operation.getOutput();
    if (outputMessage != null && outputMessage.getExtensionAttributes() != null) {
        String outputAction = InternalContextUtils.getAction(outputMessage);
        if (!StringUtils.isEmpty(outputAction)) {
            return outputAction;
        }
    }
    return null;
}
 
Example #26
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 #27
Source File: MAPAggregatorImpl.java    From cxf with Apache License 2.0 5 votes vote down vote up
private String getActionFromInputMessage(final OperationInfo operation) {
    MessageInfo inputMessage = operation.getInput();

    if (inputMessage.getExtensionAttributes() != null) {
        String inputAction = InternalContextUtils.getAction(inputMessage);
        if (!StringUtils.isEmpty(inputAction)) {
            return inputAction;
        }
    }
    return null;
}
 
Example #28
Source File: AbstractInDatabindingInterceptor.java    From cxf with Apache License 2.0 5 votes vote down vote up
protected MessageInfo getMessageInfo(Message message, BindingOperationInfo operation, boolean requestor) {
    MessageInfo msgInfo;
    OperationInfo intfOp = operation.getOperationInfo();
    if (requestor) {
        msgInfo = intfOp.getOutput();
        message.put(MessageInfo.class, intfOp.getOutput());
    } else {
        msgInfo = intfOp.getInput();
        message.put(MessageInfo.class, intfOp.getInput());
    }
    return msgInfo;
}
 
Example #29
Source File: ColocUtil.java    From cxf with Apache License 2.0 5 votes vote down vote up
private static MessageInfo getMessageInfo(Message message) {
    OperationInfo oi = message.getExchange().getBindingOperationInfo().getOperationInfo();
    if (MessageUtils.isOutbound(message)) {
        return oi.getOutput();
    }
    return oi.getInput();
}
 
Example #30
Source File: ClientImpl.java    From cxf with Apache License 2.0 5 votes vote down vote up
protected void setOutMessageProperties(Message message, BindingOperationInfo boi) {
    message.put(Message.REQUESTOR_ROLE, Boolean.TRUE);
    message.put(Message.INBOUND_MESSAGE, Boolean.FALSE);
    if (null != boi) {
        message.put(BindingMessageInfo.class, boi.getInput());
        message.put(MessageInfo.class, boi.getOperationInfo().getInput());
    }
}