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 CB22C104C1 for ; Tue, 4 Feb 2014 10:35:55 +0000 (UTC) Received: (qmail 20374 invoked by uid 500); 4 Feb 2014 10:35:51 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 19911 invoked by uid 500); 4 Feb 2014 10:35:50 -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 19901 invoked by uid 99); 4 Feb 2014 10:35:49 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Feb 2014 10:35:49 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of ronny.aerts@intris.be designates 213.199.154.77 as permitted sender) Received: from [213.199.154.77] (HELO emea01-db3-obe.outbound.protection.outlook.com) (213.199.154.77) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Feb 2014 10:35:45 +0000 Received: from DB3PR01MB300.eurprd01.prod.exchangelabs.com (10.141.4.153) by DB3PR01MB300.eurprd01.prod.exchangelabs.com (10.141.4.153) with Microsoft SMTP Server (TLS) id 15.0.868.8; Tue, 4 Feb 2014 10:35:21 +0000 Received: from DB3PR01MB300.eurprd01.prod.exchangelabs.com ([10.141.4.153]) by DB3PR01MB300.eurprd01.prod.exchangelabs.com ([10.141.4.153]) with mapi id 15.00.0868.013; Tue, 4 Feb 2014 10:35:21 +0000 From: Ronny Aerts To: "users@camel.apache.org" Subject: RE: can I set a message header or exchange property inside an xslt? Thread-Topic: can I set a message header or exchange property inside an xslt? Thread-Index: Ac8g6kgR1sKjQ6dfQ5SktzGlGYE2+gAH31+AAB5wcqAAA+T28A== Date: Tue, 4 Feb 2014 10:35:20 +0000 Message-ID: <6a24062ca8dd48a59899e8253035613d@DB3PR01MB300.eurprd01.prod.exchangelabs.com> References: In-Reply-To: Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [91.183.48.98] x-forefront-prvs: 01128BA907 x-forefront-antispam-report: SFV:NSPM;SFS:(10009001)(6009001)(252514010)(24454002)(13464003)(189002)(199002)(51704005)(377454003)(38564003)(71364002)(74482001)(47446002)(94316002)(74876001)(59766001)(15202345003)(74662001)(86362001)(74502001)(47736001)(76482001)(49866001)(50986001)(19619215002)(74366001)(65816001)(90146001)(77982001)(33646001)(81342001)(94946001)(69226001)(79102001)(74706001)(74316001)(63696002)(93136001)(47976001)(93516002)(81542001)(66066001)(56816005)(80022001)(15974865002)(87266001)(31966008)(92566001)(85852003)(83072002)(19580405001)(81816001)(87936001)(2656002)(81686001)(80976001)(56776001)(54316002)(16601075003)(15975445006)(85306002)(54356001)(76796001)(46102001)(76786001)(19580395003)(83322001)(51856001)(53806001)(4396001)(24736002);DIR:OUT;SFP:1101;SCL:1;SRVR:DB3PR01MB300;H:DB3PR01MB300.eurprd01.prod.exchangelabs.com;CLIP:91.183.48.98;FPR:D44CF195.ACC7991E.F0D19CB3.C0DEE040.204D9;InfoNoRecordsMX:1;A:0;LANG:en; Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: intris.be X-Virus-Checked: Checked by ClamAV on apache.org Hello, I figured it out and yes it is possible to set message headers and exchange= properties in camel xslt. I created a separate java file with content (see the methods that are marke= d static): package com.intris.camel.component.xslt; public class xsltmsg { public static void setHeader (org.apache.camel.Message message, String name= , String value) { message.setHeader(name, value); } public static void setProperty (org.apache.camel.Exchange exchange, String = name, String value) { exchange.setProperty(name, value); } } I created a xslt file: My route looks like: There is still one problem with the above: net.sf.saxon.trans.XPathException: Cannot find a matching 3-argument functi= on named {java:com.intris.camel.component.xslt.xsltmsg}setHeader(). Note th= at direct calls to Java methods are not available under Saxon-HE It seems that camel uses the saxon home edition and with the home edition i= t not possible to call java from xslt. I added a dependency to my project pom and now it works fine. net.sf.saxon saxon [8.7,) A part of the output is: , Properties: {aaa=3Dronny en gerd, ... , Headers: {bbb-2=3Dronny.aerts.2, ... The setting of a header on the in does not seem to have an effect. I would be very handy if there would such a xslt wrapper class for settings= message headers, similar to one I created. -- Kind regards, Ronny Aerts - Intris nv - Wapenstilstandlaan 47, 2600 Berchem, Belgium R&D Integration Architect Prince II certified Tel: +32-3-326.50.75 -----Original Message----- From: Ronny Aerts [mailto:ronny.aerts@intris.be] Sent: dinsdag 4 februari 2014 9:41 To: users@camel.apache.org Subject: RE: can I set a message header or exchange property inside an xslt= ? Hello Claus, Thank you for the feedback. I searched in the xslt test files and found the org.apache.camel.component.= xslt.XsltTransformingExceptionTest.java in combination with org.apache.came= l.component.xslt.MyEcho.java and org/apache/camel/component/xslt/transformC= allEcho.xsl. The xsl file declares xmlns:echo=3D"xalan://org.apache.camel.component.xslt= .MyEcho" and later on the statement is called to activate the java code. As far as I known, this approach is only possible with static methods (in t= he java code) and therefore it does not seem possible with camel out of the= box. I will try to work something. -- Kind regards, Ronny Aerts - Intris nv - Wapenstilstandlaan 47, 2600 Berchem, Belgium R&D = Integration Architect Prince II certified Tel: +32-3-326.50.75 -----Original Message----- From: Claus Ibsen [mailto:claus.ibsen@gmail.com] Sent: maandag 3 februari 2014 19:00 To: users@camel.apache.org Subject: Re: can I set a message header or exchange property inside an xslt= ? Hi You likely can. Though I can remember how that is possible. Try look at the unit tests https://github.com/apache/camel/tree/master/camel-core/src/test/java/org/ap= ache/camel/component/xslt And we love contributions. People is welcome to add details on the xslt doc= s how to do this http://camel.apache.org/contributing On Mon, Feb 3, 2014 at 3:16 PM, Ronny Aerts wrote: > Hello camel community, > > I'm working on a project where it would be very handy to me if I can set = a message header or exchange property inside the execution of an xslt produ= cer. Is this possible? > > I know that the "exchange" and "in" are passed as parameter to the transf= ormation. > > -- > Kind regards, > Ronny Aerts - Intris nv - > Wapenstilstandlaan 47, 2600 Berchem, Belgium R&D Integration Architect > Prince II certified > Tel: +32-3-326.50.75 > > > Intris nv > Wapenstilstandlaan 47 > B-2600 Berchem > Tel. +32 3 326 50 75 > Fax +32 3 326 42 23 > www.intris.be > > DISCLAIMER > This is an e-mail from Intris. The information contained in this communic= ation is intended solely for use by the individual or entity to whom it is = addressed. > Use of this communication by others is prohibited. If the e-mail message = was sent to you by mistake, please notify support@intris.be, destroy it without reading, using, copying or disclosing its co= ntents to any other person. > We accept no liability for damage related to data and/or documents which = are communicated by electronic mail. -- Claus Ibsen ----------------- Red Hat, Inc. Email: cibsen@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen Make your Camel app= lications look hawt, try: http://hawt.io Intris nv Wapenstilstandlaan 47 B-2600 Berchem Tel. +32 3 326 50 75 Fax +32 3 326 42 23 www.intris.be DISCLAIMER This is an e-mail from Intris. The information contained in this communicat= ion is intended solely for use by the individual or entity to whom it is ad= dressed. Use of this communication by others is prohibited. If the e-mail message wa= s sent to you by mistake, please notify support@intris.be, destroy it without reading, using, copying or disclosing its cont= ents to any other person. We accept no liability for damage related to data and/or documents which ar= e communicated by electronic mail. Intris nv Wapenstilstandlaan 47 B-2600 Berchem Tel. +32 3 326 50 75 Fax +32 3 326 42 23 www.intris.be DISCLAIMER This is an e-mail from Intris. The information contained in this communicat= ion is intended solely for use by the individual or entity to whom it is ad= dressed. Use of this communication by others is prohibited. If the e-mail message wa= s sent to you by mistake, please notify support@intris.be, destroy it without reading, using, copying or disclosing its cont= ents to any other person. We accept no liability for damage related to data and/or documents which ar= e communicated by electronic mail.