Java Code Examples for org.apache.cxf.service.model.BindingOperationInfo#isUnwrappedCapable()

The following examples show how to use org.apache.cxf.service.model.BindingOperationInfo#isUnwrappedCapable() . 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: CorbaStreamOutInterceptor.java    From cxf with Apache License 2.0 6 votes vote down vote up
private void handleOutBoundMessage(CorbaMessage message, BindingOperationInfo boi) {
    boolean wrap = false;
    if (boi.isUnwrappedCapable()) {
        wrap = true;
    }
    OperationType opType = boi.getExtensor(OperationType.class);
    List<ParamType> paramTypes = opType.getParam();
    List<ArgType> params = new ArrayList<>();
    for (Iterator<ParamType> iter = paramTypes.iterator(); iter.hasNext();) {
        ParamType param = iter.next();
        if (!param.getMode().equals(ModeType.OUT)) {
            params.add(param);
        }
    }
    CorbaStreamWriter writer = new CorbaStreamWriter(orb, params, typeMap, service, wrap);
    message.setContent(XMLStreamWriter.class, writer);
}
 
Example 2
Source File: CorbaStreamOutInterceptor.java    From cxf with Apache License 2.0 6 votes vote down vote up
private void handleInBoundMessage(CorbaMessage message, BindingOperationInfo boi) {
    boolean wrap = false;
    if (boi.isUnwrappedCapable()) {
        wrap = true;
    }
    OperationType opType = boi.getExtensor(OperationType.class);

    ArgType returnParam = opType.getReturn();
    List<ParamType> paramTypes = opType.getParam();
    List<ArgType> params = new ArrayList<>();
    if (returnParam != null) {
        params.add(returnParam);
    }
    for (Iterator<ParamType> iter = paramTypes.iterator(); iter.hasNext();) {
        ParamType param = iter.next();
        if (!param.getMode().equals(ModeType.IN)) {
            params.add(param);
        }
    }
    CorbaStreamWriter writer = new CorbaStreamWriter(orb, params, typeMap, service, wrap);
    message.setContent(XMLStreamWriter.class, writer);
}
 
Example 3
Source File: ClientImpl.java    From cxf with Apache License 2.0 5 votes vote down vote up
public Object[] invoke(QName operationName, Object... params) throws Exception {
    BindingOperationInfo op = getEndpoint().getEndpointInfo().getBinding().getOperation(operationName);
    if (op == null) {
        throw new UncheckedException(
            new org.apache.cxf.common.i18n.Message("NO_OPERATION", LOG, operationName));
    }

    if (op.isUnwrappedCapable()) {
        op = op.getUnwrappedOperation();
    }

    return invoke(op, params);
}
 
Example 4
Source File: ClientImpl.java    From cxf with Apache License 2.0 5 votes vote down vote up
public void invoke(ClientCallback callback,
                   QName operationName,
                   Object... params) throws Exception {
    BindingOperationInfo op = getEndpoint().getEndpointInfo().getBinding().getOperation(operationName);
    if (op == null) {
        throw new UncheckedException(
            new org.apache.cxf.common.i18n.Message("NO_OPERATION", LOG, operationName));
    }

    if (op.isUnwrappedCapable()) {
        op = op.getUnwrappedOperation();
    }

    invoke(callback, op, params);
}
 
Example 5
Source File: InternalContextUtils.java    From cxf with Apache License 2.0 4 votes vote down vote up
/**
 * Get action from service model.
 *
 * @param message the current message
 * @param fault the fault if one is set
 */
private static String getActionFromServiceModel(Message message,
                                                Exception fault) {
    String action = null;
    BindingOperationInfo bindingOpInfo =
        message.getExchange().getBindingOperationInfo();
    if (bindingOpInfo != null) {
        if (bindingOpInfo.isUnwrappedCapable()) {
            bindingOpInfo = bindingOpInfo.getUnwrappedOperation();
        }
        if (fault == null) {
            action = (String)message.get(ContextUtils.ACTION);
            if (StringUtils.isEmpty(action)) {
                action = (String) message.get(SoapBindingConstants.SOAP_ACTION);
            }
            if (action == null || "".equals(action)) {
                MessageInfo msgInfo =
                    ContextUtils.isRequestor(message)
                    ? bindingOpInfo.getOperationInfo().getInput()
                    : bindingOpInfo.getOperationInfo().getOutput();
                String cachedAction = (String)msgInfo.getProperty(ContextUtils.ACTION);
                if (cachedAction == null) {
                    action = getActionFromMessageAttributes(msgInfo);
                } else {
                    action = cachedAction;
                }
                if (action == null && ContextUtils.isRequestor(message)) {
                    SoapOperationInfo soi = getSoapOperationInfo(bindingOpInfo);
                    action = soi == null ? null : soi.getAction();
                    action = StringUtils.isEmpty(action) ? null : action;
                }
            }
        } else {
            Throwable t = fault.getCause();

            // FaultAction attribute is not defined in
            // http://www.w3.org/2005/02/addressing/wsdl schema
            for (BindingFaultInfo bfi : bindingOpInfo.getFaults()) {
                FaultInfo fi = bfi.getFaultInfo();
                if (fi.size() == 0) {
                    continue;
                }
                if (t != null && matchFault(t, fi)) {
                    if (fi.getExtensionAttributes() == null) {
                        continue;
                    }
                    String attr = (String)
                        fi.getExtensionAttributes().get(Names.WSAW_ACTION_QNAME);
                    if (attr == null) {
                        attr = (String)
                            fi.getExtensionAttributes()
                                .get(new QName(Names.WSA_NAMESPACE_WSDL_NAME_OLD,
                                                Names.WSAW_ACTION_NAME));
                    }
                    if (attr != null) {
                        action = attr;
                        break;
                    }
                }
            }
        }
    }
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("action determined from service model: " + action);
    }
    return action;
}
 
Example 6
Source File: CorbaStreamInInterceptor.java    From cxf with Apache License 2.0 4 votes vote down vote up
private void handleReply(Message msg) {
    ORB orb;
    ServiceInfo service;
    CorbaDestination destination;
    if (msg.getDestination() != null) {
        destination = (CorbaDestination)msg.getDestination();
    } else {
        destination = (CorbaDestination)msg.getExchange().getDestination();
    }
    service = destination.getBindingInfo().getService();

    CorbaMessage message = (CorbaMessage)msg;
    if (message.getStreamableException() != null || message.getSystemException() != null) {
        message.setContent(Exception.class,
                           message.getExchange().getOutMessage().getContent(Exception.class));

        Endpoint ep = message.getExchange().getEndpoint();
        message.getInterceptorChain().abort();
        if (ep.getInFaultObserver() != null) {
            ep.getInFaultObserver().onMessage(message);
            return;
        }
    }

    CorbaMessage outMessage = (CorbaMessage)message.getExchange().getOutMessage();
    orb = message.getExchange().get(ORB.class);
    HandlerIterator paramIterator = new HandlerIterator(outMessage, false);

    CorbaTypeEventProducer eventProducer = null;
    Exchange exchange = message.getExchange();
    BindingOperationInfo bindingOpInfo = exchange.getBindingOperationInfo();
    BindingMessageInfo msgInfo = bindingOpInfo.getOutput();

    boolean wrap = false;
    if (bindingOpInfo.isUnwrappedCapable()) {
        wrap = true;
    }

    if (wrap) {
        // wrapper element around our args
        // REVISIT, bravi, message name same as the element name
        QName wrapperElementQName = msgInfo.getMessageInfo().getName();
        eventProducer = new WrappedParameterSequenceEventProducer(wrapperElementQName,
                                                                  paramIterator,
                                                                  service,
                                                                  orb);
    } else {
        eventProducer = new ParameterEventProducer(paramIterator,
                                                   service,
                                                   orb);
    }
    CorbaStreamReader reader = new CorbaStreamReader(eventProducer);
    message.setContent(XMLStreamReader.class, reader);
}
 
Example 7
Source File: CorbaStreamInInterceptor.java    From cxf with Apache License 2.0 4 votes vote down vote up
private void handleRequest(Message msg) {
    ORB orb;
    ServiceInfo service;
    CorbaDestination destination;
    if (msg.getDestination() != null) {
        destination = (CorbaDestination)msg.getDestination();
    } else {
        destination = (CorbaDestination)msg.getExchange().getDestination();
    }
    service = destination.getBindingInfo().getService();

    CorbaMessage message = (CorbaMessage) msg;

    Exchange exchange = message.getExchange();

    CorbaTypeMap typeMap = message.getCorbaTypeMap();

    BindingInfo bInfo = destination.getBindingInfo();
    InterfaceInfo info = bInfo.getInterface();
    String opName = exchange.get(String.class);
    Iterator<BindingOperationInfo> i = bInfo.getOperations().iterator();
    OperationType opType = null;
    BindingOperationInfo bopInfo = null;
    QName opQName = null;
    while (i.hasNext()) {
        bopInfo = i.next();
        if (bopInfo.getName().getLocalPart().equals(opName)) {
            opType = bopInfo.getExtensor(OperationType.class);
            opQName = bopInfo.getName();
            break;
        }
    }

    if (opType == null) {
        throw new RuntimeException("Couldn't find the binding operation for " + opName);
    }

    orb = exchange.get(ORB.class);

    ServerRequest request = exchange.get(ServerRequest.class);
    NVList list = prepareArguments(message, info, opType,
                                   opQName, typeMap,
                                   destination, service);
    request.arguments(list);
    message.setList(list);

    HandlerIterator paramIterator = new HandlerIterator(message, true);

    CorbaTypeEventProducer eventProducer = null;
    BindingMessageInfo msgInfo = bopInfo.getInput();
    boolean wrap = false;
    if (bopInfo.isUnwrappedCapable()) {
        wrap = true;
    }

    if (wrap) {
        // wrapper element around our args
        QName wrapperElementQName = msgInfo.getMessageInfo().getName();
        eventProducer = new WrappedParameterSequenceEventProducer(wrapperElementQName,
                                                                  paramIterator,
                                                                  service,
                                                                  orb);
    } else {
        eventProducer = new ParameterEventProducer(paramIterator,
                                                   service,
                                                   orb);
    }
    CorbaStreamReader reader = new CorbaStreamReader(eventProducer);
    message.setContent(XMLStreamReader.class, reader);
}