camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Müller <christian.muel...@gmail.com>
Subject Re: Validate Xml
Date Tue, 30 Jul 2013 22:13:32 GMT
Not answering your question, but why you do not configure CXF to validate
the request?

Best,
Christian
Am 30.07.2013 16:16 schrieb "bocamel" <johnzyin@gmail.com>:

> I recently ran into this scenario.  My Camel route acts as a web services
> server that receives an XML message in PAYLOAD format.  The very next step
> in the route after receiving the message is to validate the message using
> <to uri="validator:xxxxxxxx.xsd"/>.  However, if the input XML message is
> not well formed, Camel generates a CamelRuntimeException before passing it
> to the validator.  I ended up having to parse this CamelRuntimeException.
> In the case of ill-formed XML, the exception always contains "Problem
> converting content to Element".  I used the following exception handling to
> send back a soap fault to the web services client:
>
> <camel:onException>
>         <camel:exception>java.lang.RuntimeException</camel:exception>
>         <camel:handled>
>                 <camel:constant>true</camel:constant>
>         </camel:handled>
>         <camel:filter>
>                 <camel:spel>#{properties['CamelExceptionCaught'] matches
> '.*Problem
> converting content to Element.*'}</camel:spel>
>                 <camel:process ref="throwExceptionProcessor" />
>         </camel:filter>
> </camel:onException>
>
> The throwExceptionProcess bean builds a SOAP fault message and sets the
> HTTP
> code to 400.
>
> If there is a better way to do this, I would like to know.
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Validate-Xml-tp472122p5736492.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message