Search in sources :

Example 91 with OperationInfo

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

the class ParameterProcessor method isRefElement.

private boolean isRefElement(MessagePartInfo outputPart, QName outElement) {
    OperationInfo wrappedOp = outputPart.getMessageInfo().getOperation().getUnwrappedOperation();
    MessagePartInfo mpart = wrappedOp.getOutput().getMessagePart(outElement);
    if (mpart == null) {
        return false;
    }
    return mpart.getProperty("isRefElement") != null;
}
Also used : OperationInfo(org.apache.cxf.service.model.OperationInfo) MessagePartInfo(org.apache.cxf.service.model.MessagePartInfo)

Example 92 with OperationInfo

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

the class PortTypeProcessor method process.

public void process(ServiceInfo serviceInfo) throws ToolException {
    operationMap.clear();
    JavaModel jmodel = context.get(JavaModel.class);
    InterfaceInfo interfaceInfo = serviceInfo.getInterface();
    if (interfaceInfo == null) {
        return;
    }
    JavaInterface intf = getInterface(context, serviceInfo, interfaceInfo);
    intf.setJavaModel(jmodel);
    Element handler = (Element) context.get(ToolConstants.HANDLER_CHAIN);
    intf.setHandlerChains(handler);
    Collection<OperationInfo> operations = interfaceInfo.getOperations();
    for (OperationInfo operation : operations) {
        if (isOverloading(operation.getName())) {
            LOG.log(Level.WARNING, "SKIP_OVERLOADED_OPERATION", operation.getName());
            continue;
        }
        OperationProcessor operationProcessor = new OperationProcessor(context);
        operationProcessor.process(intf, operation);
    }
    jmodel.setLocation(intf.getLocation());
    jmodel.addInterface(intf.getName(), intf);
}
Also used : OperationInfo(org.apache.cxf.service.model.OperationInfo) JavaInterface(org.apache.cxf.tools.common.model.JavaInterface) JavaModel(org.apache.cxf.tools.common.model.JavaModel) Element(org.w3c.dom.Element) InterfaceInfo(org.apache.cxf.service.model.InterfaceInfo)

Example 93 with OperationInfo

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

the class MethodMapperTest method testMapWrappedOperation.

@Test
public void testMapWrappedOperation() throws Exception {
    OperationInfo operation = getOperation();
    operation.setUnwrappedOperation(operation);
    JavaMethod method = new MethodMapper().map(operation);
    assertNotNull(method);
    assertTrue(method.isWrapperStyle());
}
Also used : OperationInfo(org.apache.cxf.service.model.OperationInfo) JavaMethod(org.apache.cxf.tools.common.model.JavaMethod) Test(org.junit.Test)

Example 94 with OperationInfo

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

the class MethodMapperTest method getOperation.

private OperationInfo getOperation() {
    OperationInfo operation = new OperationInfo();
    operation.setName(new QName("urn:test:ns", "OperationTest"));
    return operation;
}
Also used : OperationInfo(org.apache.cxf.service.model.OperationInfo) QName(javax.xml.namespace.QName)

Example 95 with OperationInfo

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

the class ColocMessageObserver method onMessage.

public void onMessage(Message m) {
    Bus origBus = BusFactory.getAndSetThreadDefaultBus(bus);
    ClassLoaderHolder origLoader = null;
    try {
        if (loader != null) {
            origLoader = ClassLoaderUtils.setThreadContextClassloader(loader);
        }
        if (LOG.isLoggable(Level.FINER)) {
            LOG.finer("Processing Message at collocated endpoint.  Request message: " + m);
        }
        Exchange ex = new ExchangeImpl();
        setExchangeProperties(ex, m);
        Message inMsg = endpoint.getBinding().createMessage();
        MessageImpl.copyContent(m, inMsg);
        // Copy Request Context to Server inBound Message
        // TODO a Context Filter Strategy required.
        inMsg.putAll(m);
        inMsg.put(COLOCATED, Boolean.TRUE);
        inMsg.put(Message.REQUESTOR_ROLE, Boolean.FALSE);
        inMsg.put(Message.INBOUND_MESSAGE, Boolean.TRUE);
        BindingOperationInfo boi = ex.getBindingOperationInfo();
        OperationInfo oi = boi != null ? boi.getOperationInfo() : null;
        if (oi != null) {
            inMsg.put(MessageInfo.class, oi.getInput());
        }
        ex.setInMessage(inMsg);
        inMsg.setExchange(ex);
        if (LOG.isLoggable(Level.FINEST)) {
            LOG.finest("Build inbound interceptor chain.");
        }
        // Add all interceptors between USER_LOGICAL and INVOKE.
        SortedSet<Phase> phases = new TreeSet<Phase>(bus.getExtension(PhaseManager.class).getInPhases());
        ColocUtil.setPhases(phases, Phase.USER_LOGICAL, Phase.INVOKE);
        InterceptorChain chain = ColocUtil.getInInterceptorChain(ex, phases);
        chain.add(addColocInterceptors());
        inMsg.setInterceptorChain(chain);
        // Convert the coloc object type if necessary
        BindingOperationInfo bop = m.getExchange().getBindingOperationInfo();
        OperationInfo soi = bop != null ? bop.getOperationInfo() : null;
        if (soi != null && oi != null) {
            if (ColocUtil.isAssignableOperationInfo(soi, Source.class) && !ColocUtil.isAssignableOperationInfo(oi, Source.class)) {
                // converting source -> pojo
                ColocUtil.convertSourceToObject(inMsg);
            } else if (ColocUtil.isAssignableOperationInfo(oi, Source.class) && !ColocUtil.isAssignableOperationInfo(soi, Source.class)) {
                // converting pojo -> source
                ColocUtil.convertObjectToSource(inMsg);
            }
        }
        chain.doIntercept(inMsg);
        if (soi != null && oi != null) {
            if (ColocUtil.isAssignableOperationInfo(soi, Source.class) && !ColocUtil.isAssignableOperationInfo(oi, Source.class) && ex.getOutMessage() != null) {
                // converting pojo -> source
                ColocUtil.convertObjectToSource(ex.getOutMessage());
            } else if (ColocUtil.isAssignableOperationInfo(oi, Source.class) && !ColocUtil.isAssignableOperationInfo(soi, Source.class) && ex.getOutMessage() != null) {
                // converting pojo -> source
                ColocUtil.convertSourceToObject(ex.getOutMessage());
            }
        }
        // Set Server OutBound Message onto InBound Exchange.
        setOutBoundMessage(ex, m.getExchange());
    } finally {
        if (origBus != bus) {
            BusFactory.setThreadDefaultBus(origBus);
        }
        if (origLoader != null) {
            origLoader.reset();
        }
    }
}
Also used : Exchange(org.apache.cxf.message.Exchange) BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) OperationInfo(org.apache.cxf.service.model.OperationInfo) Bus(org.apache.cxf.Bus) InterceptorChain(org.apache.cxf.interceptor.InterceptorChain) BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) Phase(org.apache.cxf.phase.Phase) Message(org.apache.cxf.message.Message) TreeSet(java.util.TreeSet) ClassLoaderHolder(org.apache.cxf.common.classloader.ClassLoaderUtils.ClassLoaderHolder) ExchangeImpl(org.apache.cxf.message.ExchangeImpl) Source(javax.xml.transform.Source)

Aggregations

OperationInfo (org.apache.cxf.service.model.OperationInfo)135 BindingOperationInfo (org.apache.cxf.service.model.BindingOperationInfo)87 QName (javax.xml.namespace.QName)58 MessagePartInfo (org.apache.cxf.service.model.MessagePartInfo)44 MessageInfo (org.apache.cxf.service.model.MessageInfo)40 Test (org.junit.Test)38 ServiceInfo (org.apache.cxf.service.model.ServiceInfo)36 InterfaceInfo (org.apache.cxf.service.model.InterfaceInfo)31 Method (java.lang.reflect.Method)25 Endpoint (org.apache.cxf.endpoint.Endpoint)24 Service (org.apache.cxf.service.Service)22 BindingInfo (org.apache.cxf.service.model.BindingInfo)21 EndpointInfo (org.apache.cxf.service.model.EndpointInfo)19 SoapOperationInfo (org.apache.cxf.binding.soap.model.SoapOperationInfo)17 Exchange (org.apache.cxf.message.Exchange)17 ArrayList (java.util.ArrayList)13 UnwrappedOperationInfo (org.apache.cxf.service.model.UnwrappedOperationInfo)13 BindingMessageInfo (org.apache.cxf.service.model.BindingMessageInfo)12 Fault (org.apache.cxf.interceptor.Fault)10 Message (org.apache.cxf.message.Message)10