You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Deepthi <de...@gmail.com> on 2012/08/06 21:39:15 UTC

Re: Setting url {params} in REST call with Camel

I am getting Route exception if i give the route in following manner:

<camel:route>
                        <camel:from
                                uri="file://[directory path]" />
                        <camel:setHeader headerName="header1">
                                       
<camel:xpath>/order/item/id</camel:xpath>
                                </camel:setHeader>
                        <camel:to
                               
uri="http://localhost:9002/REST-Webservice/rest/{header1}/WebService" />
                </camel:route>

Where am i going wrong? I see the test case executed in the same manner.

Thanks,
Deepthi



--
View this message in context: http://camel.465427.n5.nabble.com/Setting-url-params-in-REST-call-with-Camel-tp2257861p5716890.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Setting url {params} in REST call with Camel

Posted by Christian Müller <ch...@gmail.com>.
Maybe my example will help you [1]...[4]...

Or try
<camel:route>
  <camel:from uri="file://[directory path]" />
  <camel:setHeader headerName="id">
    <camel:xpath>/order/item/id</camel:xpath>
  </camel:setHeader>
  <camel:setHeader headerName="CamelHttpPath">
    <camel:simple>/rest/${header[id]}/WebService</camel:simple>
  </camel:setHeader>
  <camel:to uri="http://localhost:9002/REST-Webservice" />
</camel:route>


[1]
https://github.com/muellerc/camel-in-daily-use/blob/master/part-2/src/test/java/org/apache/cmueller/camel/sus/cidu/part1/CustomerServiceResource.java
[2]
https://github.com/muellerc/camel-in-daily-use/blob/master/part-2/src/main/java/org/apache/cmueller/camel/sus/cidu/part1/PrepareRestRequest.java
[3]
https://github.com/muellerc/camel-in-daily-use/blob/master/part-2/src/main/java/org/apache/cmueller/camel/sus/cidu/part1/Route3.java
[4]
https://github.com/muellerc/camel-in-daily-use/blob/master/part-2/src/test/resources/part-1.cfg

Best,
Christian

On Mon, Aug 6, 2012 at 9:39 PM, Deepthi <de...@gmail.com> wrote:

> I am getting Route exception if i give the route in following manner:
>
> <camel:route>
>                         <camel:from
>                                 uri="file://[directory path]" />
>                         <camel:setHeader headerName="header1">
>
> <camel:xpath>/order/item/id</camel:xpath>
>                                 </camel:setHeader>
>                         <camel:to
>
> uri="http://localhost:9002/REST-Webservice/rest/{header1}/WebService" />
>                 </camel:route>
>
> Where am i going wrong? I see the test case executed in the same manner.
>
> Thanks,
> Deepthi
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Setting-url-params-in-REST-call-with-Camel-tp2257861p5716890.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



--