You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by david_geary <da...@lagan.com> on 2009/02/25 13:09:38 UTC
Setting initial xml content for timer mesages
I want to use a timer to call a web service so i need to set the xml body of
the message. Im using the xml configuration so I know I can do this:
<route>
<from uri="timer://myTimer?fixedRate=true&period=2000"/>
<setBody>
<simple>${in.body} World!</simple>
</setBody>
<to uri=....>
</route>
But how can i use this to set xml content? What's the correct syntax for
this - or is there a better way to do it? Reading the content from a file
would suit also.
--
View this message in context: http://www.nabble.com/Setting-initial-xml-content-for-timer-mesages-tp22201587p22201587.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
Re: Setting initial xml content for timer mesages
Posted by david_geary <da...@lagan.com>.
Well that's another part I'm trying to work out - what i want to do is set up
a timer to call a web service every so often and then further process the
results of that call. So I was just wanting to set the message to be the xml
request and then fire that directly at the web service via an http
component.
So I want to just set up some static XML after the message is generated from
the timer. Ive got this working now using escaped XML in the XML
configuration - but thats a bit messy and was wondering was there an easier
/ nicer way to do it?
Also Im having a few problems setting the SOAPAction header on the http call
- what's the syntax for that (in XML config)
Im trying to avoid writing java or using cxf and trying to see how far I can
get with just xml config - in spring integration there is a web service
endpoint that wraps the xml in soap before sending it, but here using the
http endpoint Im guessing I just have to put the soap in manually?
Claus Ibsen-2 wrote:
>
> On Wed, Feb 25, 2009 at 1:09 PM, david_geary <da...@lagan.com>
> wrote:
>>
>> I want to use a timer to call a web service so i need to set the xml body
>> of
>> the message. Im using the xml configuration so I know I can do this:
>>
>> <route>
>> <from uri="timer://myTimer?fixedRate=true&period=2000"/>
>> <setBody>
>> <simple>${in.body} World!</simple>
>> </setBody>
>> <to uri=....>
>> </route>
>>
>> But how can i use this to set xml content? What's the correct syntax for
>> this - or is there a better way to do it? Reading the content from a file
>> would suit also.
> Hi
>
> There are many ways of transforming/translate a message with Camel
> http://camel.apache.org/message-translator.html
>
> How are you gonna call the webserivce? Are you using a webservice
> framework or what?
>
>
>> --
>> View this message in context:
>> http://www.nabble.com/Setting-initial-xml-content-for-timer-mesages-tp22201587p22201587.html
>> Sent from the Camel - Users (activemq) mailing list archive at
>> Nabble.com.
>>
>>
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
>
>
--
View this message in context: http://www.nabble.com/Re%3A-Setting-initial-xml-content-for-timer-mesages-tp22203133p22209978.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Setting initial xml content for timer mesages
Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Feb 26, 2009 at 5:31 AM, Hadrian Zbarcea <hz...@gmail.com> wrote:
> Looks like velocity is the simplest solution for your problem here.
> Hadrian
Yeah I was about to suggest the same, Velocity, Freemarker og that
StringTemplate.
Can all read a template file and transform it. However you can leave
the template 100% as your static XML.
The camel-http component allows you to set
- http method to use, and you need POST. Will default to POST since
you have a body payload
- set http headers from the exchange in headers.
There is a setHeader XML tag you can use to set the soapaction.
>
>
> On Feb 25, 2009, at 8:46 AM, Claus Ibsen wrote:
>
>> On Wed, Feb 25, 2009 at 1:09 PM, david_geary <da...@lagan.com>
>> wrote:
>>>
>>> I want to use a timer to call a web service so i need to set the xml body
>>> of
>>> the message. Im using the xml configuration so I know I can do this:
>>>
>>> <route>
>>> <from uri="timer://myTimer?fixedRate=true&period=2000"/>
>>> <setBody>
>>> <simple>${in.body} World!</simple>
>>> </setBody>
>>> <to uri=....>
>>> </route>
>>>
>>> But how can i use this to set xml content? What's the correct syntax for
>>> this - or is there a better way to do it? Reading the content from a file
>>> would suit also.
>>
>> Hi
>>
>> There are many ways of transforming/translate a message with Camel
>> http://camel.apache.org/message-translator.html
>>
>> How are you gonna call the webserivce? Are you using a webservice
>> framework or what?
>>
>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Setting-initial-xml-content-for-timer-mesages-tp22201587p22201587.html
>>> Sent from the Camel - Users (activemq) mailing list archive at
>>> Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>
>
--
Claus Ibsen
Apache Camel Committer
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Re: Setting initial xml content for timer mesages
Posted by Hadrian Zbarcea <hz...@gmail.com>.
Looks like velocity is the simplest solution for your problem here.
Hadrian
On Feb 25, 2009, at 8:46 AM, Claus Ibsen wrote:
> On Wed, Feb 25, 2009 at 1:09 PM, david_geary <da...@lagan.com>
> wrote:
>>
>> I want to use a timer to call a web service so i need to set the
>> xml body of
>> the message. Im using the xml configuration so I know I can do this:
>>
>> <route>
>> <from uri="timer://myTimer?fixedRate=true&period=2000"/>
>> <setBody>
>> <simple>${in.body} World!</simple>
>> </setBody>
>> <to uri=....>
>> </route>
>>
>> But how can i use this to set xml content? What's the correct
>> syntax for
>> this - or is there a better way to do it? Reading the content from
>> a file
>> would suit also.
> Hi
>
> There are many ways of transforming/translate a message with Camel
> http://camel.apache.org/message-translator.html
>
> How are you gonna call the webserivce? Are you using a webservice
> framework or what?
>
>
>> --
>> View this message in context: http://www.nabble.com/Setting-initial-xml-content-for-timer-mesages-tp22201587p22201587.html
>> Sent from the Camel - Users (activemq) mailing list archive at
>> Nabble.com.
>>
>>
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
Re: Setting initial xml content for timer mesages
Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Feb 25, 2009 at 1:09 PM, david_geary <da...@lagan.com> wrote:
>
> I want to use a timer to call a web service so i need to set the xml body of
> the message. Im using the xml configuration so I know I can do this:
>
> <route>
> <from uri="timer://myTimer?fixedRate=true&period=2000"/>
> <setBody>
> <simple>${in.body} World!</simple>
> </setBody>
> <to uri=....>
> </route>
>
> But how can i use this to set xml content? What's the correct syntax for
> this - or is there a better way to do it? Reading the content from a file
> would suit also.
Hi
There are many ways of transforming/translate a message with Camel
http://camel.apache.org/message-translator.html
How are you gonna call the webserivce? Are you using a webservice
framework or what?
> --
> View this message in context: http://www.nabble.com/Setting-initial-xml-content-for-timer-mesages-tp22201587p22201587.html
> Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
>
>
--
Claus Ibsen
Apache Camel Committer
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Re: Setting initial xml content for timer mesages
Posted by Ashwin Karpe <as...@progress.com>.
Hi David,
This is not possible without adding a processor behaving like a payload
transformer/replacer. The way to do this is
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="timer://myTimer?fixedRate=true&period=2000"/>
<process ref="MyBodyReplacementProcessor"/>
<to uri="..."/>
</route>
</camelContext>
In myBodyReplacementProcessor
public class MyBodyReplacementProcessor implements Processor {
public void process(Exchange exchange) throws Exception {
String payload = exchange.getIn().getBody(String.class);
// do something with the payload and/or exchange here
exchange.getIn().setBody("Changed body (XML Message)");
}
}
This should allow the body to be replaced by your XML messahe and sent to
the final URI.
Hope this helps.
Cheers,
Ashwin...
david_geary wrote:
>
> I want to use a timer to call a web service so i need to set the xml body
> of the message. Im using the xml configuration so I know I can do this:
>
> <route>
> <from uri="timer://myTimer?fixedRate=true&period=2000"/>
> <setBody>
> <simple>${in.body} World!</simple>
> </setBody>
> <to uri=....>
> </route>
>
> But how can i use this to set xml content? What's the correct syntax for
> this - or is there a better way to do it? Reading the content from a file
> would suit also.
>
-----
---
Ashwin Karpe, Principal Consultant, PS - Opensource Center of Competence
Progress Software Corporation
14 Oak Park Drive
Bedford, MA 01730
---
+1-972-304-9084 (Office)
+1-972-971-1700 (Mobile)
----
Blog: http://opensourceknowledge.blogspot.com/
--
View this message in context: http://www.nabble.com/Setting-initial-xml-content-for-timer-mesages-tp22201587p22231076.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.