You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by horyna <ph...@centrum.cz> on 2015/09/12 16:17:37 UTC

How to set body part with using of XML DSL

Hi,

need set part of body - code below. Pls. how to do it? First <simple>
element is not alowed after <to>. Second the code below dont work :)

thx.

  <to uri="switchyard://SomeService"/>
  <simple>{$body.context.requestId} = {$property.requestId}</simple>
</when>



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-set-body-part-with-using-of-XML-DSL-tp5771461.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to set body part with using of XML DSL

Posted by Claus Ibsen <cl...@gmail.com>.
Simple does not support that. You can use some of the other languages
like mvel, groovy etc.

On Sun, Sep 13, 2015 at 11:22 AM, horyna <ph...@centrum.cz> wrote:
> Thx. for reply. But me problem is, that i need to set just a field value
> inside body object. You promise change complete body part.
>
> I need to do body.getContext().setReqeustId(property.getRequestId()); using
> Camel.
>
> Thats why i wrote:
> <simple>{$body.context.requestId} = {$property.requestId}</simple>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-set-body-part-with-using-of-XML-DSL-tp5771461p5771466.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2nd edition:
https://www.manning.com/books/camel-in-action-second-edition

Re: How to set body part with using of XML DSL

Posted by horyna <ph...@centrum.cz>.
Thx. for reply. But me problem is, that i need to set just a field value
inside body object. You promise change complete body part.

I need to do body.getContext().setReqeustId(property.getRequestId()); using
Camel.

Thats why i wrote:
<simple>{$body.context.requestId} = {$property.requestId}</simple>



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-set-body-part-with-using-of-XML-DSL-tp5771461p5771466.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to set body part with using of XML DSL

Posted by Andrew Block <an...@gmail.com>.
Just realized that the $ were incorrectly placed within the simple tag. It should read ${body.context.requestId} = ${property.requestId}</simple>. 

-- 
Andrew Block


On September 12, 2015 at 1:58:28 PM, Andrew Block (andy.block@gmail.com) wrote:

You can you the simple language to set the body within a camel message using the setBody tag. An example of this for your scenario would be as follows

<to uri="switchyard://SomeService"/> 
<setBody>
<simple>{$body.context.requestId} = {$property.requestId}</simple> 
</setBody>

It is my assumption that your code sample was a snippet that is part a larger code sample since there is a trailing </when> tag that I did not account for.

Thanks,
Andy



-- 
Andrew Block
On September 12, 2015 at 9:17:48 AM, horyna (phofficial@centrum.cz) wrote:

Hi,

need set part of body - code below. Pls. how to do it? First <simple>
element is not alowed after <to>. Second the code below dont work :)

thx.

<to uri="switchyard://SomeService"/>
<simple>{$body.context.requestId} = {$property.requestId}</simple>
</when>



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-set-body-part-with-using-of-XML-DSL-tp5771461.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to set body part with using of XML DSL

Posted by Andrew Block <an...@gmail.com>.
You can you the simple language to set the body within a camel message using the setBody tag. An example of this for your scenario would be as follows

<to uri="switchyard://SomeService"/> 
<setBody>
<simple>{$body.context.requestId} = {$property.requestId}</simple> 
</setBody>

It is my assumption that your code sample was a snippet that is part a larger code sample since there is a trailing </when> tag that I did not account for.

Thanks,
Andy



-- 
Andrew Block
On September 12, 2015 at 9:17:48 AM, horyna (phofficial@centrum.cz) wrote:

Hi,  

need set part of body - code below. Pls. how to do it? First <simple>  
element is not alowed after <to>. Second the code below dont work :)  

thx.  

<to uri="switchyard://SomeService"/>  
<simple>{$body.context.requestId} = {$property.requestId}</simple>  
</when>  



--  
View this message in context: http://camel.465427.n5.nabble.com/How-to-set-body-part-with-using-of-XML-DSL-tp5771461.html  
Sent from the Camel - Users mailing list archive at Nabble.com.