Package org.apache.cxf.service.model

Examples of org.apache.cxf.service.model.BindingOperationInfo


                // create a Camel exchange, the default MEP is InOut
                org.apache.camel.Exchange camelExchange = endpoint.createExchange();

                DataFormat dataFormat = endpoint.getDataFormat();

                BindingOperationInfo boi = cxfExchange.getBindingOperationInfo();
                // make sure the "boi" is remained as wrapped in PAYLOAD mode
                if (boi != null && dataFormat == DataFormat.PAYLOAD && boi.isUnwrapped()) {
                    boi = boi.getWrappedOperation();
                    cxfExchange.put(BindingOperationInfo.class, boi);
                }
               
                if (boi != null) {
                    camelExchange.setProperty(BindingOperationInfo.class.getName(), boi);
                    LOG.trace("Set exchange property: BindingOperationInfo: {}", boi);
                    // set the message exchange patter with the boi
                    if (boi.getOperationInfo().isOneWay()) {
                        camelExchange.setPattern(ExchangePattern.InOnly);
                    }
                }
               
                // set data format mode in Camel exchange
View Full Code Here


            ExchangeImpl cxfExchange = new ExchangeImpl();
            // set the Bus on the exchange in case the CXF interceptor need to access it from exchange
            cxfExchange.put(Bus.class, endpoint.getBus());
           
            // prepare binding operation info
            BindingOperationInfo boi = prepareBindingOperation(camelExchange, cxfExchange);
           
            Map<String, Object> invocationContext = new HashMap<String, Object>();
            Map<String, Object> responseContext = new HashMap<String, Object>();
            invocationContext.put(Client.RESPONSE_CONTEXT, responseContext);
            invocationContext.put(Client.REQUEST_CONTEXT, prepareRequest(camelExchange, cxfExchange));
           
            CxfClientCallback cxfClientCallback = new CxfClientCallback(callback, camelExchange, cxfExchange, boi,
                                                                        endpoint.getCxfBinding());
            // send the CXF async request
            client.invoke(cxfClientCallback, boi, getParams(endpoint, camelExchange),
                          invocationContext, cxfExchange);
            if (boi.getOperationInfo().isOneWay()) {
                callback.done(false);
            }
        } catch (Throwable ex) {
            // error occurred before we had a chance to go async
            // so set exception and invoke callback true
View Full Code Here

        ExchangeImpl cxfExchange = new ExchangeImpl();
        // set the Bus on the exchange in case the CXF interceptor need to access it from exchange
        cxfExchange.put(Bus.class, endpoint.getBus());
       
        // prepare binding operation info
        BindingOperationInfo boi = prepareBindingOperation(camelExchange, cxfExchange);
       
        Map<String, Object> invocationContext = new HashMap<String, Object>();
        Map<String, Object> responseContext = new HashMap<String, Object>();
        invocationContext.put(Client.RESPONSE_CONTEXT, responseContext);
        invocationContext.put(Client.REQUEST_CONTEXT, prepareRequest(camelExchange, cxfExchange));
       
        try {
            // send the CXF request
            client.invoke(boi, getParams(endpoint, camelExchange),
                      invocationContext, cxfExchange);

        } catch (Exception exception) {
            camelExchange.setException(exception);
        } finally {
            // bind the CXF response to Camel exchange
            if (!boi.getOperationInfo().isOneWay()) {
                // copy the InMessage header to OutMessage header
                camelExchange.getOut().getHeaders().putAll(camelExchange.getIn().getHeaders());
                endpoint.getCxfBinding().populateExchangeFromCxfResponse(camelExchange, cxfExchange,
                        responseContext);
            }
View Full Code Here

        return requestContext.getWrappedMap();
    }
   
    private BindingOperationInfo prepareBindingOperation(Exchange camelExchange, org.apache.cxf.message.Exchange cxfExchange) {
        // get binding operation info
        BindingOperationInfo boi = getBindingOperationInfo(camelExchange);
        ObjectHelper.notNull(boi, "BindingOperationInfo");
       
        // keep the message wrapper in PAYLOAD mode
        if (endpoint.getDataFormat() == DataFormat.PAYLOAD && boi.isUnwrapped()) {
            boi = boi.getWrappedOperation();
            cxfExchange.put(BindingOperationInfo.class, boi);
           
        }
       
        // store the original boi in the exchange
        camelExchange.setProperty(BindingOperationInfo.class.getName(), boi);
        LOG.trace("Set exchange property: BindingOperationInfo: {}", boi);

        // Unwrap boi before passing it to make a client call
        if (endpoint.getDataFormat() != DataFormat.PAYLOAD && !endpoint.isWrapped() && boi != null) {
            if (boi.isUnwrappedCapable()) {
                boi = boi.getUnwrappedOperation();
                LOG.trace("Unwrapped BOI {}", boi);
            }
        }
        return  boi;
    }
View Full Code Here

        }
        return  boi;
    }
   
    private void checkParameterSize(CxfEndpoint endpoint, Exchange exchange, Object[] parameters) {
        BindingOperationInfo boi = getBindingOperationInfo(exchange);
        if (boi == null) {
            throw new RuntimeCamelException("Can't find the binding operation information from camel exchange");
        }
        if (!endpoint.isWrapped()) {
            if (boi.isUnwrappedCapable()) {
                boi = boi.getUnwrappedOperation();
            }
        }
        int experctMessagePartsSize = boi.getInput().getMessageParts().size();
       
        if (parameters.length < experctMessagePartsSize) {
            throw new IllegalArgumentException("Get the wrong parameter size to invoke the out service, Expect size "
                                               + experctMessagePartsSize + ", Parameter size " + parameters.length
                                               + ". Please check if the message body matches the CXFEndpoint POJO Dataformat request.");
        }
       
        if (parameters.length > experctMessagePartsSize) {
            // need to check the holder parameters       
            int holdersSize = 0;           
            for (Object parameter : parameters) {
                if (parameter instanceof Holder) {
                    holdersSize++;
                }
            }
            // need to check the soap header information
            int soapHeadersSize = 0;
            BindingMessageInfo bmi =  boi.getInput();
            if (bmi != null) {
                List<SoapHeaderInfo> headers = bmi.getExtensors(SoapHeaderInfo.class);
                if (headers != null) {
                    soapHeadersSize = headers.size();
                }
View Full Code Here

     * Get operation name from header and use it to lookup and return a
     * {@link BindingOperationInfo}.
     */
    private BindingOperationInfo getBindingOperationInfo(Exchange ex) {
        CxfEndpoint endpoint = (CxfEndpoint)this.getEndpoint();
        BindingOperationInfo answer = null;
        String lp = ex.getIn().getHeader(CxfConstants.OPERATION_NAME, String.class);
        if (lp == null) {
            lp = endpoint.getDefaultOperationName();
        }
        if (lp == null) {
View Full Code Here

        Method method = null;
        QName operationName = null;
        ExchangePattern mep = ExchangePattern.InOut;
       
        // extract binding operation information
        BindingOperationInfo boi = camelExchange.getProperty(BindingOperationInfo.class.getName(),
                                                             BindingOperationInfo.class);
        if (boi != null) {
            Service service = cxfExchange.get(Service.class);
            if (service != null) {
                MethodDispatcher md = (MethodDispatcher)service.get(MethodDispatcher.class.getName());
                if (md != null) {
                    method = md.getMethod(boi);
                }
            }
           
            if (boi.getOperationInfo().isOneWay()) {
                mep = ExchangePattern.InOnly;
            }
               
            operationName = boi.getName();
        }
       
        // set operation name in header
        if (operationName != null) {
            camelExchange.getIn().setHeader(CxfConstants.OPERATION_NAMESPACE,
                    boi.getName().getNamespaceURI());
            camelExchange.getIn().setHeader(CxfConstants.OPERATION_NAME,
                    boi.getName().getLocalPart());
            if (LOG.isTraceEnabled()) {
                LOG.trace("Set IN header: {}={}",
                        CxfConstants.OPERATION_NAMESPACE, boi.getName().getNamespaceURI());
                LOG.trace("Set IN header: {}={}",
                        CxfConstants.OPERATION_NAME, boi.getName().getLocalPart());
            }
        } else if (method != null) {
            camelExchange.getIn().setHeader(CxfConstants.OPERATION_NAME, method.getName());
            if (LOG.isTraceEnabled()) {
                LOG.trace("Set IN header: {}={}",
View Full Code Here

            if (attachments != null) {
                outMessage.setAttachments(attachments);
            }
        }
      
        BindingOperationInfo boi = cxfExchange.get(BindingOperationInfo.class);
        if (boi != null) {
            cxfExchange.put(BindingMessageInfo.class, boi.getOutput());
        }
       
    }
View Full Code Here

    // Non public methods
    // -------------------------------------------------------------------------
   
    protected MessageContentsList getResponsePayloadList(org.apache.cxf.message.Exchange exchange,
                                                         List<Source> elements) {
        BindingOperationInfo boi = exchange.getBindingOperationInfo();

        if (boi.isUnwrapped()) {
            boi = boi.getWrappedOperation();
            exchange.put(BindingOperationInfo.class, boi);
        }
       
        MessageContentsList answer = new MessageContentsList();

        int i = 0;
        if (boi.getOutput() != null) {
            for (MessagePartInfo partInfo : boi.getOutput().getMessageParts()) {
                if (elements != null && elements.size() > i) {
                    answer.put(partInfo, elements.get(i++));
                }
            }
        }
View Full Code Here

        MessageContentsList inObjects = MessageContentsList.getContentsList(message);
        if (inObjects == null) {
            return new ArrayList<Source>(0);
        }
        org.apache.cxf.message.Exchange exchange = message.getExchange();
        BindingOperationInfo boi = exchange.getBindingOperationInfo();

        OperationInfo op = boi.getOperationInfo();
       
        if (boi.isUnwrapped()) {
            op = boi.getWrappedOperation().getOperationInfo();
        }

        List<MessagePartInfo> partInfos = null;
        boolean client = Boolean.TRUE.equals(message.get(Message.REQUESTOR_ROLE));
        if (client) {
View Full Code Here

TOP

Related Classes of org.apache.cxf.service.model.BindingOperationInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.