You could use an enricher pattern. See
http://camel.apache.org/content-enricher.html. This is a "call-out" pattern.

The gist is that you use the enrich() DSL providing the endpoint of the
external validation web service. You pass in an aggregation strategy
alongside too. The role of the aggregation strategy is to merge the
response of the validation service with the original Exchange. I suggest
that depending on the response of the validation WS, your aggregation
strategy sets a named property on the Exchange (e.g. ValidationOK) with a
boolean value: true or false.

If the validation failed, you can also set another property called
ValidationErrorDetail, where you extract the validation error message, to
later construct the fixed response.

Now that your message is enriched, all you need to do is apply
Content-Based Routing to either direct the exchange to the backend service,
or simply throw an Exception which would be interpreted as a SOAP fault by
the consumer CXF endpoint.

Take a look at http://camel.apache.org/content-based-router.html and
http://camel.apache.org/simple.html, to better understand Content-Based
Routing and the Simple language, to write the predicate.

Hope this helps!

Regards,

*Raúl Kripalani*
Principal Consultant | FuseSource Corp.
[email protected] | fusesource.com <http://www.fusesource.com/>
skype: raul.fuse | twitter: @raulvk <http://twitter.com/raulvk>,
@fusenews<http://twitter.com/fusenews>

On 23 March 2012 13:24, Kerry Barnes <[email protected]> wrote:

> I am trying to see how to handle the following situation in Camel, can
> someone please enlighten me?
>
> 1. Accepts a SOAP request from a CXF Endpoint
> 2. Extract information from the SOAP message
> 3. Send the extracted information to a Web Service endpoint
>
> ... here is where I am scratching my head ...
>
> 4. Based on the result of the web service in #3 I will either:
>  *  proxy the *original* SOAP request from step #1
>  *  or create a SOAPFault to send back to the client
>
> This seems like it should be so easy, but I am just missing something
> simple
> is my guess.  Can anyone here throw me some breadcrumbs?
>
> Thanks
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/In-route-validation-tp5589442p5589442.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Reply via email to