You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by javakurious <ja...@gmail.com> on 2012/08/14 07:51:20 UTC
returning xml file content as response
Hi
I have a very straightforward question..
In my camel config, I am trying to handle exception be returning a static
xml response, indicating that there was an error.
So, in <onException> tag, I just send the message to a <direct> component in
a different route. And for each message in that <direct> component I just
want to return content of a static xml file.
How can I do that ?
<route>
<from uri="direct:invalidCredentialQueue"/>
<to uri="file:templates/invalid-credentials-response.xml"/>
</route>
Thanks for any help.
--
View this message in context: http://camel.465427.n5.nabble.com/returning-xml-file-content-as-response-tp5717284.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: returning xml file content as response
Posted by javakurious <ja...@gmail.com>.
Thanks for the response. Using enricher seemed lit bit more work for a simple
task. The body of the exchange was XML, so I instead used an xslt to
generate a static content
<route>
<from uri="direct:invalidCredentialQueue"/>
<to
uri="xslt:xslts/invalid-credentials-response-generator.xsl"/>
</route>
Where the stylesheet just matches the '/' and outputs the desired xml file.
--
View this message in context: http://camel.465427.n5.nabble.com/returning-xml-file-content-as-response-tp5717284p5717560.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: returning xml file content as response
Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Aug 14, 2012 at 7:51 AM, javakurious <ja...@gmail.com> wrote:
> Hi
>
> I have a very straightforward question..
>
> In my camel config, I am trying to handle exception be returning a static
> xml response, indicating that there was an error.
>
> So, in <onException> tag, I just send the message to a <direct> component in
> a different route. And for each message in that <direct> component I just
> want to return content of a static xml file.
>
> How can I do that ?
>
> <route>
> <from uri="direct:invalidCredentialQueue"/>
> <to uri="file:templates/invalid-credentials-response.xml"/>
> </route>
>
> Thanks for any help.
>
You need to use the EIPs such as the content enricher to enrich the
message with the content from the XML file
http://camel.apache.org/content-enricher.html
And in your use-case, you need to use the pollEnrich to poll the
content from the file.
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/returning-xml-file-content-as-response-tp5717284.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Re: returning xml file content as response
Posted by Henryk Konsek <he...@gmail.com>.
Hi,
> In my camel config, I am trying to handle exception be returning a static
> xml response, indicating that there was an error.
If the response is static indeed, you can use Java DSL and set the
body to constant value.
from("direct:invalidCredentialQueue").
setBody(constant(MyMessageUtil.getMsg("invalidCredential")));
Laters.
--
Henryk Konsek
http://henryk-konsek.blogspot.com