How to switch the CXF consumer between HTTP and HTTPS without touching the Spring configuration
Skip to end of metadata
Go to start of metadata

You can find general information how to secure your Camel CXF Consumer with HTTPS here

A simple Camel CXF Consumer configuration which use the http:conduit configuration to enable SSL and an external properties file for all environment specific configurations could looks like:

bundle-context.xml

The environment specific configurations are externalized into a properties file:

orderEntry.cfg

With this configuration, you Camel CXF consumer connects with HTTPS to the web service provider.
If you need to change the protocol to HTTP, maybe for tracing/debugging reasons, change the endpointUri property in your properties file to e.g. http://localhost:8080/OrderEntry. That's all! Isn't it easy.
Apache CXF detects that you "only" use HTTP and instantiates a HttpURLConnectionFactoryImpl instead of a HttpsURLConnectionFactory.

Labels
  • No labels