Hi

Sorry this is rubbish what I write. The code below is for consuming
only, such as polling a file.

What you wanted was to call an external http server and get the response.
- You can do as Willem suggested directly in the route without the Processor
- From the Processor you can use the ProducerTemplate to call and get
response in a single codeline

public void process(Exchange exchange) {
  ProducerTemplate producer =
exchange.getCamelContext().createProducerTemplate();
  Object response =
producer.sendBody("http://myserver.com/myapp?foo=bar";, "Liv Camel
POC");
}

On Thu, Jan 8, 2009 at 2:01 PM, Claus Ibsen <claus.ib...@gmail.com> wrote:
> Hi
>
> You can use the producer template to call an external http server and
> get the response.
>
> See this tutorial:
> http://activemq.apache.org/camel/tutorial-axis-camel.html
>
> From the section - integrating Camel
>
> Its kinda the same but its just uses the producer template to save a
> file. Its the same API for using any of the camel components.
>
> Little sidenote:
> And since you use InOut you should use: requestBody instread of
> sendBody. However Camel is not to stricky about this yet so if you use
> a send instead of request then it should work as well.
>
> The demo shows how to inject a producer template from spring into your
> bean class = your processor. when you have this template you can call
> the external http server and get the response using the requestBody
> method.
>
>
>
>
>
>
>
> On Thu, Jan 8, 2009 at 1:46 PM, Liav Ezer <liav.e...@gmail.com> wrote:
>>
>> Hi,
>>
>> Here is my camel-context:
>>
>>  <camelContext id="camel"
>> xmlns="http://activemq.apache.org/camel/schema/spring";>
>>    <package>org.apache.servicemix.tutorial.camel</package>
>>  </camelContext>
>>
>>  <bean id="myProcessor"
>> class="org.apache.servicemix.tutorial.camel.MyProcessor"/>
>>
>> Here is my RouteBuilder java file:
>>
>> public class MyRouteBuilder extends RouteBuilder {
>>        public void configure() {
>>        from("timer://tutorial?fixedRate=true&delay=3000&period=10000")
>>                .setBody(constant(".....................Liav Camel
>> POC......................."))
>>                        .to("myProcessor");
>>
>>    }
>> }
>>
>> Here is my processor java file:
>> public class MyProcessor implements Processor {
>>          public void process(Exchange exchange) throws Exception {
>>              //WANT TO INITIATE A CALL TO http pROVIDER END POINT & PASS THE
>> 'FROM'
>>                  // PARAMETRS RECIEVED PROIRE TO THE PROCESSOR INVOKE.   }
>> }
>>
>> Thanks.
>> --
>> View this message in context: 
>> http://www.nabble.com/How-do-i-call-an-HTTP-Provider-end-pont-from-the-process-method--tp21351142s22882p21351142.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>
>
>
> --
>
> /Claus Ibsen
> Apache Camel Committer
> Blog: http://davsclaus.blogspot.com/
>



-- 

/Claus Ibsen
Apache Camel Committer
Blog: http://davsclaus.blogspot.com/

Reply via email to