This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Child pages
  • CXF Proxy Example

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

If you use Maven then you can easily run it from the command line using:

...

About

This example demonstrates how CXF can be used to proxy a real web service. For this example we want Camel to validate and enrich the input message before it's sent to the actual web service. We do this to ensure the data is correct and to have Camel automatically add in any missing information. In real life you may wish to use a proxy in cases where clients are sending bad/faulty data to a web service, and it's costly/not possible to update and fix those clients.

...

As you can see in the Camel route we use a CXF consumer to proxy the web service. Then we route the message to the EnrichBean which validates and adds the missing information. Then we just use the HTTP component to send the web service request to the real web service.
The reply from the real web service is then logged and used as a reply for the proxied web service as well.

...

Enrich bean

The enrich bean is Java code which in our simple example will just set the incidentId parameter to the fixed value of 456. In your implementation you can of course do a lot more.

...

Running the example

You start the example from the command line using the Maven goal mvn camel:run.
You can also start the Camel application from your IDE, by running the org.apache.camel.example.cxf.proxy.MyMain main class.

...

Here is a sample output from the console:

...

See Also