camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "M.Ismail" <mohammed.h...@gmail.com>
Subject Re: XPath expression inside doTry()
Date Wed, 09 Jun 2010 09:13:34 GMT

Now I am getting this error: 

"The method when(XPathBuilder) is undefined for the type TryDefinition
MyRouteBuilder.java	/Migration-simple-router/src/main/java/tutorial	line
135"
I think that it is "only" accpeted if 
Here is my route:
        from("jetty:http://0.0.0.0:9000/")
        .doTry()

        .process(new Parser())
        .convertBodyTo(String.class)
        .when(.when(xpath("/ns:API[@DTC=\"001\"]").namespace("ns",
"http://mydomain.com.eg")))
        .process(new fwdConverter())
       .setHeader("Content-Type",constant("text/xml; charset=utf-8"))
       .to("http://172.10.10.1/")
       .convertBodyTo(String.class)
        .process(new backwdConverter())
        .convertBodyTo(String.class)
        .process(new XmlEmbedder())
        .transform(body())
        .doCatch(IllegalInputOrProcessingException.class)
        .process(new ExceptionProcessorHandler())
        .transform(body())
        .process(new XmlEmbedder())
        .end();

btw: if I add .choice() before when(xpath(.... then I get the old error:
"The method doCatch(Class<IllegalInputOrProcessingException>) is undefined
for the type ChoiceDefinition	MyRouteBuilder.java
/Migration-simple-router/src/main/java/tutorial	line 147"



Claus Ibsen-2 wrote:
> 
> Hi
> 
> The XPathBuilder have methods as well to set the namespace
>         xpath("/foo").namespace("pre", "http://acme/cheese");
> 
> 
> 
> On Tue, Jun 8, 2010 at 3:36 PM, M.Ismail <mohammed.hany@gmail.com> wrote:
>>
>> Hi,
>>
>> Tried this but and it didn't work:
>>
>> 1- There is no overloaded function for xpath() that takes the namespace
>> as
>> the second argument.
>> 2- Still receive the same compilation error: "The method doCatch
>> Class<IllegalInputOrProcessingException>) is undefined> for the type
>> ChoiceDefinition   MyRouteBuilder.java
>>
>> What if I used OnException clause like this:
>> OnException(IllegalInputOrProcessingException.class)
>>       .process(new ExceptionProcessorHandler())
>>       .transform(body())
>>       .process(new XmlEmbedder())
>>
>> Will it behave the same?
>>
>> Thanks
>>
>>
>> Claus Ibsen-2 wrote:
>>>
>>> Hi
>>>
>>> Put xpath inside the when method
>>>     when(xpath("xxxx"))
>>>
>>> There is a XPathBuilder in builder.xml package and you can static
>>> import the xpath method on it.
>>>
>>>
>>> On Sun, Jun 6, 2010 at 4:27 PM, M.Ismail <mohammed.hany@gmail.com>
>>> wrote:
>>>>
>>>> Hi all,
>>>>
>>>> I have noticed that it is not possible to put an xpath expression
>>>> inside
>>>> a
>>>> doTry expression:
>>>> e.g.
>>>>
>>>>        from("jetty:http://0.0.0.0:9000/")
>>>>        .doTry()
>>>>
>>>>        .process(new Parser())
>>>>        .convertBodyTo(String.class)
>>>>         .choice()
>>>>        .when()
>>>>        .xpath("/ns:API[@DTC='001']",ns)
>>>>        .process(new fwdConverter())
>>>>        .setHeader("Content-Type",constant("text/xml; charset=utf-8"))
>>>>       .to("http://172.10.10.1/")
>>>>       .convertBodyTo(String.class)
>>>>        .process(new backwdConverter())
>>>>        .convertBodyTo(String.class)
>>>>        .process(new XmlEmbedder())
>>>>        .transform(body())
>>>>        .doCatch(IllegalInputOrProcessingException.class)
>>>>        .process(new ExceptionProcessorHandler())
>>>>        .transform(body())
>>>>        .process(new XmlEmbedder())
>>>>        .end();
>>>>
>>>> I receive this following compilation error:
>>>> "The method doCatch(Class<IllegalInputOrProcessingException>) is
>>>> undefined
>>>> for the type ChoiceDefinition   MyRouteBuilder.java
>>>> /Max-router/src/main/java/tutorial      line 145"
>>>>
>>>>
>>>> Any ideas?
>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://old.nabble.com/XPath-expression-inside-doTry%28%29-tp28793165p28793165.html
>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> Apache Camel Committer
>>>
>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>> Open Source Integration: http://fusesource.com
>>> Blog: http://davsclaus.blogspot.com/
>>> Twitter: http://twitter.com/davsclaus
>>>
>>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/XPath-expression-inside-doTry%28%29-tp28793165p28817959.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> Claus Ibsen
> Apache Camel Committer
> 
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> 
> 

-- 
View this message in context: http://old.nabble.com/XPath-expression-inside-doTry%28%29-tp28793165p28827784.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message