Search in sources :

Example 61 with MessageInfo

use of org.apache.cxf.service.model.MessageInfo in project cxf by apache.

the class WrapperClassGenerator method generate.

public Set<Class<?>> generate() {
    for (OperationInfo opInfo : interfaceInfo.getOperations()) {
        if (opInfo.isUnwrappedCapable()) {
            Method method = (Method) opInfo.getProperty(ReflectionServiceFactoryBean.METHOD);
            if (method == null) {
                continue;
            }
            MessagePartInfo inf = opInfo.getInput().getFirstMessagePart();
            if (inf.getTypeClass() == null) {
                MessageInfo messageInfo = opInfo.getUnwrappedOperation().getInput();
                createWrapperClass(inf, messageInfo, opInfo, method, true);
            }
            MessageInfo messageInfo = opInfo.getUnwrappedOperation().getOutput();
            if (messageInfo != null) {
                inf = opInfo.getOutput().getFirstMessagePart();
                if (inf.getTypeClass() == null) {
                    createWrapperClass(inf, messageInfo, opInfo, method, false);
                }
            }
        }
    }
    return wrapperBeans;
}
Also used : OperationInfo(org.apache.cxf.service.model.OperationInfo) Method(java.lang.reflect.Method) MessagePartInfo(org.apache.cxf.service.model.MessagePartInfo) MessageInfo(org.apache.cxf.service.model.MessageInfo)

Example 62 with MessageInfo

use of org.apache.cxf.service.model.MessageInfo in project cxf by apache.

the class JaxWsServiceConfigurationTest method testGetInPartName.

@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);
}
Also used : ServiceInfo(org.apache.cxf.service.model.ServiceInfo) OperationInfo(org.apache.cxf.service.model.OperationInfo) QName(javax.xml.namespace.QName) WebMethod(javax.jws.WebMethod) Method(java.lang.reflect.Method) MessageInfo(org.apache.cxf.service.model.MessageInfo) Test(org.junit.Test)

Example 63 with MessageInfo

use of org.apache.cxf.service.model.MessageInfo in project cxf by apache.

the class RMEndpoint method addAction.

private void addAction(BindingOperationInfo boi, String action, String outputAction) {
    SoapOperationInfo soi = new SoapOperationInfo();
    soi.setAction(action);
    boi.addExtensor(soi);
    MessageInfo info = boi.getOperationInfo().getInput();
    if (info != null) {
        info.addExtensionAttribute(JAXWSAConstants.WSAW_ACTION_QNAME, action);
    }
    info = boi.getOperationInfo().getOutput();
    if (info != null) {
        info.addExtensionAttribute(JAXWSAConstants.WSAW_ACTION_QNAME, outputAction);
    }
}
Also used : SoapOperationInfo(org.apache.cxf.binding.soap.model.SoapOperationInfo) MessageInfo(org.apache.cxf.service.model.MessageInfo)

Example 64 with MessageInfo

use of org.apache.cxf.service.model.MessageInfo in project cxf by apache.

the class RMEndpoint method buildCloseSequenceOperationInfo.

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);
    }
}
Also used : OperationInfo(org.apache.cxf.service.model.OperationInfo) SoapOperationInfo(org.apache.cxf.binding.soap.model.SoapOperationInfo) BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) MessagePartInfo(org.apache.cxf.service.model.MessagePartInfo) MessageInfo(org.apache.cxf.service.model.MessageInfo)

Example 65 with MessageInfo

use of org.apache.cxf.service.model.MessageInfo in project cxf by apache.

the class RMEndpoint method buildCreateSequenceOperationInfo.

void buildCreateSequenceOperationInfo(InterfaceInfo ii, ProtocolVariation protocol) {
    OperationInfo operationInfo = null;
    MessagePartInfo partInfo = null;
    MessageInfo messageInfo = null;
    RMConstants consts = protocol.getConstants();
    operationInfo = ii.addOperation(consts.getCreateSequenceOperationName());
    messageInfo = operationInfo.createMessage(consts.getCreateSequenceOperationName(), MessageInfo.Type.INPUT);
    operationInfo.setInput(messageInfo.getName().getLocalPart(), messageInfo);
    partInfo = messageInfo.addMessagePart(CREATE_PART_NAME);
    partInfo.setElementQName(consts.getCreateSequenceOperationName());
    partInfo.setElement(true);
    partInfo.setTypeClass(protocol.getCodec().getCreateSequenceType());
    messageInfo = operationInfo.createMessage(consts.getCreateSequenceResponseOperationName(), MessageInfo.Type.OUTPUT);
    operationInfo.setOutput(messageInfo.getName().getLocalPart(), messageInfo);
    partInfo = messageInfo.addMessagePart(CREATE_RESPONSE_PART_NAME);
    partInfo.setElementQName(consts.getCreateSequenceResponseOperationName());
    partInfo.setElement(true);
    partInfo.setTypeClass(protocol.getCodec().getCreateSequenceResponseType());
    partInfo.setIndex(0);
    operationInfo = ii.addOperation(consts.getCreateSequenceOnewayOperationName());
    messageInfo = operationInfo.createMessage(consts.getCreateSequenceOnewayOperationName(), MessageInfo.Type.INPUT);
    operationInfo.setInput(messageInfo.getName().getLocalPart(), messageInfo);
    partInfo = messageInfo.addMessagePart(CREATE_PART_NAME);
    partInfo.setElementQName(consts.getCreateSequenceOnewayOperationName());
    partInfo.setElement(true);
    partInfo.setTypeClass(protocol.getCodec().getCreateSequenceType());
    operationInfo = ii.addOperation(consts.getCreateSequenceResponseOnewayOperationName());
    messageInfo = operationInfo.createMessage(consts.getCreateSequenceResponseOnewayOperationName(), MessageInfo.Type.INPUT);
    operationInfo.setInput(messageInfo.getName().getLocalPart(), messageInfo);
    partInfo = messageInfo.addMessagePart(CREATE_RESPONSE_PART_NAME);
    partInfo.setElementQName(consts.getCreateSequenceResponseOnewayOperationName());
    partInfo.setElement(true);
    partInfo.setTypeClass(protocol.getCodec().getCreateSequenceResponseType());
}
Also used : OperationInfo(org.apache.cxf.service.model.OperationInfo) SoapOperationInfo(org.apache.cxf.binding.soap.model.SoapOperationInfo) BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) MessagePartInfo(org.apache.cxf.service.model.MessagePartInfo) MessageInfo(org.apache.cxf.service.model.MessageInfo)

Aggregations

MessageInfo (org.apache.cxf.service.model.MessageInfo)69 QName (javax.xml.namespace.QName)41 OperationInfo (org.apache.cxf.service.model.OperationInfo)39 BindingOperationInfo (org.apache.cxf.service.model.BindingOperationInfo)36 MessagePartInfo (org.apache.cxf.service.model.MessagePartInfo)36 BindingMessageInfo (org.apache.cxf.service.model.BindingMessageInfo)19 SoapOperationInfo (org.apache.cxf.binding.soap.model.SoapOperationInfo)15 ServiceInfo (org.apache.cxf.service.model.ServiceInfo)14 Test (org.junit.Test)14 Endpoint (org.apache.cxf.endpoint.Endpoint)13 Method (java.lang.reflect.Method)9 ArrayList (java.util.ArrayList)9 Service (org.apache.cxf.service.Service)9 MessageContentsList (org.apache.cxf.message.MessageContentsList)8 Fault (org.apache.cxf.interceptor.Fault)7 Exchange (org.apache.cxf.message.Exchange)7 BindingInfo (org.apache.cxf.service.model.BindingInfo)7 FaultInfo (org.apache.cxf.service.model.FaultInfo)7 Message (org.apache.cxf.message.Message)6 UnwrappedOperationInfo (org.apache.cxf.service.model.UnwrappedOperationInfo)6