Interface CxfBinding

  • All Known Implementing Classes:
    DefaultCxfBinding

    public interface CxfBinding
    An strategy interface for implementing binding between CXF Exchange and Camel Exchange. Assumptions: CxfProducer and CxfConsumer set DataFormat and BindingOperationInfo in Camel Exchange property before calling into these methods.
    Since:
    2.0
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void copyJaxWsContext​(org.apache.cxf.message.Exchange cxfExchange, Map<String,​Object> context)
      Copy the javax.xml.ws* headers into cxfExchange's outMessage, if the cxfExchange has no outMessage, skip this copy
      void extractJaxWsContext​(org.apache.cxf.message.Exchange cxfExchange, Map<String,​Object> context)
      Extract the message headers which key are start from javax.xml.ws* from the CXF exchange's inMessage, and put these headers into the context
      void populateCxfRequestFromExchange​(org.apache.cxf.message.Exchange cxfExchange, org.apache.camel.Exchange camelExchange, Map<String,​Object> requestContext)
      Populate a CXF Exchange from a Camel Exchange.
      void populateCxfResponseFromExchange​(org.apache.camel.Exchange camelExchange, org.apache.cxf.message.Exchange cxfExchange)
      Populate a CXF Exchange from a Camel Exchange.
      void populateExchangeFromCxfRequest​(org.apache.cxf.message.Exchange cxfExchange, org.apache.camel.Exchange camelExchange)
      Populate a Camel Exchange from a CXF Exchange, which is an incoming request from a CXF client.
      void populateExchangeFromCxfResponse​(org.apache.camel.Exchange camelExchange, org.apache.cxf.message.Exchange cxfExchange, Map<String,​Object> responseContext)
      Populate a Camel Exchange from a CXF Exchange, which is a an incoming response from a CXF server.
    • Method Detail

      • populateCxfRequestFromExchange

        void populateCxfRequestFromExchange​(org.apache.cxf.message.Exchange cxfExchange,
                                            org.apache.camel.Exchange camelExchange,
                                            Map<String,​Object> requestContext)

        Populate a CXF Exchange from a Camel Exchange. The resulted CXF Exchange is an outgoing request to be sent to CXF server. This method is called by CxfProducer.process(org.apache.camel.Exchange) to process a Camel Exchange for invoking an CXF web service operation. Note that information is populated to CXF Exchange and the request context, which are passed as arguments to the CXF API's Client.invoke() method. The arguments to the web service operation are extracted from the Camel IN message body by CxfProducer.

        Exchange is passed in this direction: Camel route => CxfProducer => apply this binding method => CXF server

        Parameters:
        cxfExchange - exchange to be populated
        camelExchange - exchange that contains a request
        requestContext - a map contains request contexts. This parameter must not be null. The Client.invoke() method does not allow caller to pass in a CXF Message. The request context are copied to the CXF Message by the Client.invoke() method. This is how caller can set properties on the CXF message.
      • populateExchangeFromCxfResponse

        void populateExchangeFromCxfResponse​(org.apache.camel.Exchange camelExchange,
                                             org.apache.cxf.message.Exchange cxfExchange,
                                             Map<String,​Object> responseContext)

        Populate a Camel Exchange from a CXF Exchange, which is a an incoming response from a CXF server. This method is called by CxfProducer after it makes an invocation to the Client.invoke() method. It calls this method to translate the CXF response message to Camel message.

        Exchange is passed in this direction: Camel route <= apply this binding method <= CxfProducer <= CXF Server

        Parameters:
        camelExchange - exchanged to be populated
        cxfExchange - exchange that contains a response
        responseContext - map contains response context from CXF
      • populateExchangeFromCxfRequest

        void populateExchangeFromCxfRequest​(org.apache.cxf.message.Exchange cxfExchange,
                                            org.apache.camel.Exchange camelExchange)

        Populate a Camel Exchange from a CXF Exchange, which is an incoming request from a CXF client. This method is called by CxfConsumer to handle a CXF request arrives at an endpoint. It translates a CXF request to a Camel Exchange for Camel route to process the exchange.

        Exchange is passed in this direction: CXF Endpoint => CxfConsumer => apply this binding method => Camel route

        Parameters:
        cxfExchange - CXF exchange that contains a request
        camelExchange - Camel exchange to be populated
      • populateCxfResponseFromExchange

        void populateCxfResponseFromExchange​(org.apache.camel.Exchange camelExchange,
                                             org.apache.cxf.message.Exchange cxfExchange)

        Populate a CXF Exchange from a Camel Exchange. The resulted CXF Exchange is an outgoing response to be sent back to the CXF client. This method is called by CxfConsumer to translate a Camel Exchange to a CXF response Exchange.

        Exchange is passed in this direction: CXF Endpoint <= apply this binding method <= CxfConsumer <= Camel route

        Parameters:
        camelExchange - Camel exchange that contains an out message
        cxfExchange - CXF exchange to be populated
      • extractJaxWsContext

        void extractJaxWsContext​(org.apache.cxf.message.Exchange cxfExchange,
                                 Map<String,​Object> context)

        Extract the message headers which key are start from javax.xml.ws* from the CXF exchange's inMessage, and put these headers into the context

        Parameters:
        cxfExchange - CXF exchange to be populated
        context - The map which used to store the message headers
      • copyJaxWsContext

        void copyJaxWsContext​(org.apache.cxf.message.Exchange cxfExchange,
                              Map<String,​Object> context)

        Copy the javax.xml.ws* headers into cxfExchange's outMessage, if the cxfExchange has no outMessage, skip this copy

        Parameters:
        cxfExchange - CXF exchange to be populated
        context - The map which used to store the message headers