You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Lydie <lp...@completegenomics.com> on 2014/04/03 00:40:51 UTC

camel jsonpath

Hello,

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


Any idea?

Thank you

Lydie



--
View this message in context: http://camel.465427.n5.nabble.com/camel-jsonpath-tp5749674.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel jsonpath

Posted by Willem Jiang <wi...@gmail.com>.
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 (lprevost@completegenomics.com) 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.
>  


Re: camel jsonpath

Posted by Lydie <lp...@completegenomics.com>.
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.

Re: camel jsonpath

Posted by Willem Jiang <wi...@gmail.com>.
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 (lprevost@completegenomics.com) 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.
>  


Re: camel jsonpath

Posted by Lydie <lp...@completegenomics.com>.
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.

Re: camel jsonpath

Posted by Willem Jiang <wi...@gmail.com>.
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 (lprevost@completegenomics.com) 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.
>  


Re: camel jsonpath

Posted by Lydie <lp...@completegenomics.com>.
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.

Re: camel jsonpath

Posted by Willem Jiang <wi...@gmail.com>.
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 (willem.jiang@gmail.com) 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 (lprevost@completegenomics.com) 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.
> >
>  
>  


Re: camel jsonpath

Posted by Willem Jiang <wi...@gmail.com>.
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 (lprevost@completegenomics.com) 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.
>  


Re: camel jsonpath

Posted by Lydie <lp...@completegenomics.com>.
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.

Re: camel jsonpath

Posted by Lydie <lp...@completegenomics.com>.
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





--
View this message in context: http://camel.465427.n5.nabble.com/camel-jsonpath-tp5749674p5749676.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel jsonpath

Posted by Gnanaguru S <gn...@gmail.com>.
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



--
View this message in context: http://camel.465427.n5.nabble.com/camel-jsonpath-tp5749674p5749675.html
Sent from the Camel - Users mailing list archive at Nabble.com.