Here is my question: How do I configure a cxfrs client in Camel route to be able to converse with a proxy server blocking access to a JAXRS endpoint?

I have done a fair bit of investigation into this and here is what I have as background information:

I have a route which routes to JAXRS endpoint that looks something like this:


  <!-- Defined the server endpoint to create the cxf-rs consumer -->
  <cxf:rsServer id="rsServer" address="http://localhost:9000";
serviceClass ="org.apache.camel.component.cxf.jaxrs.testbean.CustomerService" />

  <!-- Defined the client endpoint to create the cxf-rs consumer -->
  <cxf:rsClient id="rsClient" address="http://localhost:9002";
serviceClass ="org.apache.camel.component.cxf.jaxrs.testbean.CustomerService"/>

  <!-- The camel route context -->
<camelContext id="camel" xmlns="http://camel.apache.org/schema/ spring">
    <route>
       <from uri="cxfrs://bean://rsServer"/>
       <to uri="cxfrs://bean://rsClient"/>
    </route>
  </camelContext>

However, the remote host is blocked by a Proxy server. Therefore I need to configure the cxfrs producer/client to talk to a Proxy server. If this was a standalone JAXRS client I would simply add this configuration element to the spring.xml used to configure the CXF bus used by the JAXRS client:

  <http-conf:conduit name="*.http-conduit">
<http-conf:client ProxyServer="remote_host" ProxyServerPort="9090"/>
</http-conf:conduit>

However, adding this to the spring config used to initialize the Camel ApplicationContext has no effect since a default bus is created during the creation of the rsClient bean which does not have access to any configuration information in the Camel application context. From the schema for the cxfrs client, it appears that I can use the bus attribute to set my own bus(documentation is unclear on this point), however, this does not provide me with a simple solution as even if I define my own <cxf:bus> element to inject into the cxfrs client, I still have to be able to add the policy/config information to the bus for the client to use. To do this it looks like I would have to create my own CXF Feature to perform this injection and then set this Feature on the <cxf:bus> element.

Is there another solution that I am missing to be able to connect a cxfrs client in a camel route to a proxy server?

Regards,
Seumas

Reply via email to