camel jsonpath

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

camel jsonpath

Lydie
Hello,

I am trying to log a message where I need to access  Json:
I was trying
<log message ="<jsonpath> ${headers.RouteConfiguration[targeturl]}</jsonpath>" />
where RouteConfigutation is in Json format.


Any idea?

Thank you

Lydie
Reply | Threaded
Open this post in threaded view
|

Re: camel jsonpath

Gnanaguru S
1. May be your jsonpath syntax is wrong, refer here: https://camel.apache.org/jsonpath.html
2. If not possible to use it inside log, then store it in a header using setHeader and call the headername

cheers
Guru
Reply | Threaded
Open this post in threaded view
|

Re: camel jsonpath

Lydie
Well I have realized that

my camel-context has an issue:
                        <choice>
                                <when>
                                        <jsonpath>$.RouteConfiguration[?]</jsonpath>
                                        <log message="**** targeturl DONE" />
                                </when>
                        </choice>

 Invalid content was found starting with element 'jsonpath'.

Although I put
                <dependency>
                        <groupId>org.apache.camel</groupId>
                        <artifactId>camel-jsonpath</artifactId>
                        <version>${camel-version}</version>
                </dependency>


 in my pom.xml file

Reply | Threaded
Open this post in threaded view
|

Re: camel jsonpath

Lydie
I don t see any reference to jsonpath here:


cvc-complex-type.2.4.a: Invalid content was found starting with element 'jsonpath'. One of '{"http://camel.apache.org/schema/
 spring":description, "http://camel.apache.org/schema/spring":expressionDefinition, "http://camel.apache.org/schema/
 spring":constant, "http://camel.apache.org/schema/spring":el, "http://camel.apache.org/schema/spring":groovy, "http://
 camel.apache.org/schema/spring":header, "http://camel.apache.org/schema/spring":jxpath, "http://camel.apache.org/schema/
 spring":javaScript, "http://camel.apache.org/schema/spring":language, "http://camel.apache.org/schema/spring":method, "http://
 camel.apache.org/schema/spring":mvel, "http://camel.apache.org/schema/spring":ognl, "http://camel.apache.org/schema/
 spring":php, "http://camel.apache.org/schema/spring":property, "http://camel.apache.org/schema/spring":python, "http://
 camel.apache.org/schema/spring":ref, "http://camel.apache.org/schema/spring":ruby, "http://camel.apache.org/schema/
 spring":simple, "http://camel.apache.org/schema/spring":spel, "http://camel.apache.org/schema/spring":sql, "http://
 camel.apache.org/schema/spring":tokenize, "http://camel.apache.org/schema/spring":xpath, "http://camel.apache.org/schema/
 spring":xquery}' is expected.
Reply | Threaded
Open this post in threaded view
|

Re: camel jsonpath

Willem.Jiang
Administrator
Hi, 

Which version of Camel are you using?
camel-jsonpath was just added since Camel 2.13.0.

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On April 3, 2014 at 8:24:16 AM, Lydie ([hidden email]) wrote:

> I don t see any reference to jsonpath here:
>  
>  
> cvc-complex-type.2.4.a: Invalid content was found starting with element
> 'jsonpath'. One of '{"http://camel.apache.org/schema/
> spring":description,
> "http://camel.apache.org/schema/spring":expressionDefinition,
> "http://camel.apache.org/schema/
> spring":constant, "http://camel.apache.org/schema/spring":el,
> "http://camel.apache.org/schema/spring":groovy, "http://
> camel.apache.org/schema/spring":header,
> "http://camel.apache.org/schema/spring":jxpath,
> "http://camel.apache.org/schema/
> spring":javaScript, "http://camel.apache.org/schema/spring":language,
> "http://camel.apache.org/schema/spring":method, "http://
> camel.apache.org/schema/spring":mvel,
> "http://camel.apache.org/schema/spring":ognl,
> "http://camel.apache.org/schema/
> spring":php, "http://camel.apache.org/schema/spring":property,
> "http://camel.apache.org/schema/spring":python, "http://
> camel.apache.org/schema/spring":ref,
> "http://camel.apache.org/schema/spring":ruby,
> "http://camel.apache.org/schema/
> spring":simple, "http://camel.apache.org/schema/spring":spel,
> "http://camel.apache.org/schema/spring":sql, "http://
> camel.apache.org/schema/spring":tokenize,
> "http://camel.apache.org/schema/spring":xpath,
> "http://camel.apache.org/schema/
> spring":xquery}' is expected.
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-jsonpath-tp5749674p5749677.html 
> Sent from the Camel - Users mailing list archive at Nabble.com.
>  

Reply | Threaded
Open this post in threaded view
|

Re: camel jsonpath

Willem.Jiang
Administrator
I just found the camel apache site schema need to be updated with the latest one and did a quick fix of it. Please make sure you are using Camel 2.13.0.

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On April 3, 2014 at 8:33:37 AM, Willem Jiang ([hidden email]) wrote:

> Hi,
>  
> Which version of Camel are you using?
> camel-jsonpath was just added since Camel 2.13.0.
>  
> --
> Willem Jiang
>  
> Red Hat, Inc.
> Web: http://www.redhat.com
> Blog: http://willemjiang.blogspot.com (English)
> http://jnn.iteye.com (Chinese)
> Twitter: willemjiang
> Weibo: 姜宁willem
>  
>  
>  
> On April 3, 2014 at 8:24:16 AM, Lydie ([hidden email]) wrote:
> > I don t see any reference to jsonpath here:
> >
> >
> > cvc-complex-type.2.4.a: Invalid content was found starting with element
> > 'jsonpath'. One of '{"http://camel.apache.org/schema/
> > spring":description,
> > "http://camel.apache.org/schema/spring":expressionDefinition,
> > "http://camel.apache.org/schema/
> > spring":constant, "http://camel.apache.org/schema/spring":el,
> > "http://camel.apache.org/schema/spring":groovy, "http://
> > camel.apache.org/schema/spring":header,
> > "http://camel.apache.org/schema/spring":jxpath,
> > "http://camel.apache.org/schema/
> > spring":javaScript, "http://camel.apache.org/schema/spring":language,
> > "http://camel.apache.org/schema/spring":method, "http://
> > camel.apache.org/schema/spring":mvel,
> > "http://camel.apache.org/schema/spring":ognl,
> > "http://camel.apache.org/schema/
> > spring":php, "http://camel.apache.org/schema/spring":property,
> > "http://camel.apache.org/schema/spring":python, "http://
> > camel.apache.org/schema/spring":ref,
> > "http://camel.apache.org/schema/spring":ruby,
> > "http://camel.apache.org/schema/
> > spring":simple, "http://camel.apache.org/schema/spring":spel,
> > "http://camel.apache.org/schema/spring":sql, "http://
> > camel.apache.org/schema/spring":tokenize,
> > "http://camel.apache.org/schema/spring":xpath,
> > "http://camel.apache.org/schema/
> > spring":xquery}' is expected.
> >
> >
> >
> > --
> > View this message in context: http://camel.465427.n5.nabble.com/camel-jsonpath-tp5749674p5749677.html 
> > Sent from the Camel - Users mailing list archive at Nabble.com.
> >
>  
>  

Reply | Threaded
Open this post in threaded view
|

Re: camel jsonpath

Lydie
I am using camel 2.13.0
What else do I need to do?
I added the dependencies in the pom file should I add the schema?

Reply | Threaded
Open this post in threaded view
|

Re: camel jsonpath

Willem.Jiang
Administrator
No, you don’t need to do anything.
I just have a quick question for it. Do you use blueprint to define your camel route?

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On April 4, 2014 at 2:23:58 AM, Lydie ([hidden email]) wrote:

> I am using camel 2.13.0
> What else do I need to do?
> I added the dependencies in the pom file should I add the schema?
>  
>  
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-jsonpath-tp5749674p5749737.html 
> Sent from the Camel - Users mailing list archive at Nabble.com.
>  

Reply | Threaded
Open this post in threaded view
|

Re: camel jsonpath

Lydie
no and it does not work!
Reply | Threaded
Open this post in threaded view
|

Re: camel jsonpath

Willem.Jiang
Administrator
Can you submit a simple test case to show us the error that you faced?

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On April 4, 2014 at 10:33:51 AM, Lydie ([hidden email]) wrote:
> no and it does not work!
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-jsonpath-tp5749674p5749753.html 
> Sent from the Camel - Users mailing list archive at Nabble.com.
>  

Reply | Threaded
Open this post in threaded view
|

Re: camel jsonpath

Lydie
it does not find json-path in the schema

By the way Would you know the response to my other question about xpath.
I transformed my json in xml but I have an issue to use xpath
Reply | Threaded
Open this post in threaded view
|

Re: camel jsonpath

Willem.Jiang
Administrator
Here is an example that you can take a look, the jsonpath should work in camel-2.13.0.

https://github.com/apache/camel/blob/master/components/camel-jsonpath/src/test/resources/org/apache/camel/jsonpath/SpringJsonPathCBTTest.xml

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On April 4, 2014 at 10:44:58 AM, Lydie ([hidden email]) wrote:

> it does not find json-path in the schema
>  
> By the way Would you know the response to my other question about xpath.
> I transformed my json in xml but I have an issue to use xpath
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-jsonpath-tp5749674p5749756.html 
> Sent from the Camel - Users mailing list archive at Nabble.com.
>