Return-Path: X-Original-To: apmail-camel-users-archive@www.apache.org Delivered-To: apmail-camel-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 67EEB9E84 for ; Wed, 9 May 2012 10:28:04 +0000 (UTC) Received: (qmail 55651 invoked by uid 500); 9 May 2012 10:28:03 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 55625 invoked by uid 500); 9 May 2012 10:28:03 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 55614 invoked by uid 99); 9 May 2012 10:28:03 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 May 2012 10:28:03 +0000 X-ASF-Spam-Status: No, hits=-3.7 required=5.0 tests=RCVD_IN_DNSWL_HI,SPF_PASS,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [194.11.79.120] (HELO smtpinipmch21.panalpina.com) (194.11.79.120) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 May 2012 10:27:59 +0000 X-IronPort-AV: E=Sophos;i="4.75,557,1330902000"; d="scan'208";a="252041095" Received: from ch13k200.corp.panorg.com ([157.168.68.154]) by smtpoutipmch21.panalpina.com with ESMTP; 09 May 2012 12:27:36 +0200 Received: from CH02C031.corp.panorg.com ([169.254.1.184]) by ch13k200.corp.panorg.com ([157.168.68.154]) with mapi; Wed, 9 May 2012 12:27:36 +0200 From: PAC Kieffer Guillaume To: "users@camel.apache.org" Date: Wed, 9 May 2012 12:27:34 +0200 Subject: RE: OSGi - CAMEL and Custom Namespace Thread-Topic: OSGi - CAMEL and Custom Namespace Thread-Index: Ac0tufsf7V4K60ETRb6y1HyUMA1AogACreDgAAHxQRA= Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Virus-Checked: Checked by ClamAV on apache.org Hi, Regarding the namespace and Camel 2.9 I tried also the Streaming version of the splitter: ... The token has to be the exact String of the XML instance: If the element in the instance is ; the token works but if the = namespace is defined at a higher level, the split does not occur.. And the = other way around.. The inheritNamespaceTagName did not make any change in the examples I have. In that case it could be interesting to add a namespaces attribute directly= at the route level.. Regards, Guillaume. -----Original Message----- From: PAC Kieffer Guillaume [mailto:Guillaume.Kieffer@panalpina.com]=20 Sent: Wednesday, May 09, 2012 11:19 To: users@camel.apache.org Subject: RE: OSGi - CAMEL and Custom Namespace Adding the namespaces attribute would be a good idea, especially in OSGi en= vironment. It would be more flexible than static XML declaration.=20 As a user it would make more sense to define it once, ie at the Route level= , to avoid too much XML verbosity, if you have tens of xpath expressions, b= ut as it is only useful for the xpath element..=20 Regards, Guillaume. -----Original Message----- From: Claus Ibsen [mailto:claus.ibsen@gmail.com]=20 Sent: Wednesday, May 09, 2012 10:01 To: users@camel.apache.org Subject: Re: OSGi - CAMEL and Custom Namespace On Wed, May 9, 2012 at 9:17 AM, PAC Kieffer Guillaume wrote: > Hi, > > The Xpath for the Splitter works perfectly with Camel 2.9.2! :) > imo the problem was related to the processing of Namespace prefix within = an OSGi environment... > Maybe the combination of Karaf + Camel + Blueprint + Namespaces lead to t= his specific issue. > I dont think the blueprint namespace handler, does any lookup in the OSGi service registry for namespaces. It uses the namespaces from the XML tags. I wonder if we should add a namespaces attribute to the element in Camel. And then allow to use the Camel property placeholders. foo://order" So in this case the prefix is foo, and the namespace is a placeholder with the key {{foo-ns}} Then you can define your namespaces in Blueprint using its support for placeholders http://camel.apache.org/using-propertyplaceholder.html > Regards, > Guillaume. > > > -----Original Message----- > From: PAC Kieffer Guillaume [mailto:Guillaume.Kieffer@panalpina.com] > Sent: Tuesday, May 08, 2012 15:02 > To: users@camel.apache.org > Subject: RE: OSGi - CAMEL and Custom Namespace > > Hi, > > My objective is the following to implement: > - =A0 =A0 =A0 A single bundle containing all my beans info (Java Objects = + XML bindings for JiBX + Schema files) > - =A0 =A0 =A0 Multiple bundles defining CAMEL Routes to process and route= these XML =A0messages (coming from FTP, WS..) > > My XML message contains Namespace information, =A0has to be validated, an= d filtered using XPath in CAMEL. > At first, I only added the namespace declaration in the CAMEL Context, bu= t this led to the given exception. > The local functions (local-name..) are of course working. > > As Camel is running within Karaf, I thought that the solution was to make= the namespace available through a service providing also the corresponding= Schema information. That could also be useful for pure Java bundles later.= . > > Thanks for your help and the clarifications, > > Regards, > Guillaume. > > -----Original Message----- > From: Claus Ibsen [mailto:claus.ibsen@gmail.com] > Sent: Tuesday, May 08, 2012 14:06 > To: users@camel.apache.org > Subject: Re: OSGi - CAMEL and Custom Namespace > > Hi > > Whats the use case for using a bundle to expose a namespace. I am not > sure all this is avail during the namespace parsing. > > The usual approach is just to define the namespace mapping in the XML > stanza, and then refer to it in your xpath > > > > > On Tue, May 8, 2012 at 11:15 AM, PAC Kieffer Guillaume > wrote: >> Hi Claus, >> >> I upgraded to 2.8.5 and still the same issue: >> Caused by: org.apache.xpath.domapi.XPathStylesheetDOM3Exception: Prefix = must resolve to a namespace: scs >> >> Is it worh trying 2.9.2 ? >> I do not know if the upgrade on ServiceMix would be as smooth as 2.8.4 -= > 2.8.5.. >> >> Regards, >> Guillaume. >> >> -----Original Message----- >> From: Claus Ibsen [mailto:claus.ibsen@gmail.com] >> Sent: Tuesday, May 08, 2012 08:56 >> To: users@camel.apache.org >> Subject: Re: OSGi - CAMEL and Custom Namespace >> >> Hi >> >> Have you tried with 2.8.5 version of Camel ? >> >> >> On Mon, May 7, 2012 at 2:34 PM, PAC Kieffer Guillaume >> wrote: >>> Hi, >>> >>> I am using Camel (2.8.4) XML DSL on ServiceMix 4.4.1 (OSGi environment) >>> I created a bundle exposing a custom namespace; here is the blueprint f= ile: >>> >>> >>> =A0=A0=A0 >> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 interface=3D"org.apache.aries.blue= print.NamespaceHandler"> >>> =A0=A0=A0=A0=A0=A0=A0 >>> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 >>> =A0=A0=A0=A0=A0=A0=A0 >>> =A0=A0=A0=A0=A0=A0=A0 >>> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 >>> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 >>> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 >>> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 >>> =A0=A0=A0=A0=A0=A0=A0 >>> =A0=A0=A0 >>> >>> >>> With >>> >>> org.apache.aries.blueprint.NamespaceHandler;osgi.servic= e.blueprint.namespace=3D"http://www.company.com/xmlns/scs/v${project.versio= n}" >>> >>> included in the Manifest.mf file and the XSD files available on the bun= dle root. >>> The bundle is started successfully on the environment. >>> >>> My Route blueprint file contains following declaration of CamelContext: >>> >> =A0 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 xmlns:scs=3D= "http://www.company.com/xmlns/scs/v1.0.0"> >>> >>> One of my route uses this XPath expression: name(/scs:*)=3D'XXXX' >>> I am getting the following exception while the xpath expression is bein= g evaluated: >>> >>> org.apache.camel.builder.xml.InvalidXPathExpression: Invalid xpath: nam= e(/scs:*)=3D'XXXX'. Reason: javax.xml.xpath.XPathExpressionException: org.a= pache.xpath.domapi.XPathStylesheetDOM3Exception: Prefix must resolve to a n= amespace: scs >>> >>> Referring to http://camel.465427.n5.nabble.com/fail-filter-XPATH-camel-= td476424.html adding the xmlns declaration on the CamelContext Element is s= ufficient. >>> But in this case, the namespace handler is customized and deployed on a= n OSGi env. >>> >>> Any idea how to solve that issue: >>> Using Namespace aware Xpath within Camel with a custom NamespaceHandler= started and declared as an OSGi Service ? >>> >>> Thanks for your help , >>> >>> Regards, >>> Guillaume. >> >> >> >> -- >> Claus Ibsen >> ----------------- >> CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com >> FuseSource >> Email: cibsen@fusesource.com >> Web: http://fusesource.com >> Twitter: davsclaus, fusenews >> Blog: http://davsclaus.blogspot.com/ >> Author of Camel in Action: http://www.manning.com/ibsen/ > > > > -- > Claus Ibsen > ----------------- > CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com > FuseSource > Email: cibsen@fusesource.com > Web: http://fusesource.com > Twitter: davsclaus, fusenews > Blog: http://davsclaus.blogspot.com/ > Author of Camel in Action: http://www.manning.com/ibsen/ --=20 Claus Ibsen ----------------- CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com FuseSource Email: cibsen@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/