You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Gonzalo Vasquez <gv...@altiuz.cl> on 2014/11/11 23:19:41 UTC

xmlsecurity endpoint output not "lasting"!?!?!?

Hi everybody,

I'm having trouble with the output of the xmlsecurity endpoint. I suppose the obvious is to get the signed xml as in the body of the next endpoint, but it seems a bit odd that it's only kept as is if where a "local variable" as used in formal programming languages, such as variables defined in if/while/for loops, and no longer exists upon exit. 


Have I been clear of what is happening, or am I too messy in the explanation?

What I need is to use an endpoint such as:

	<camel:to uri="xmlsecurity:sign://enveloped?keyAccessor=#keyAccessor&amp;parentLocalName=factura" />



As I need a flexible parentLocalName, I've tried two approaches:

	<camel:recipientList>
		<camel:simple>xmlsecurity:sign://enveloped?keyAccessor=#keyAccessor&amp;parentLocalName=${in.header.rootName}</camel:simple> 
	</camel:recipientList>

And:

<camel:choice>
				<camel:when>
					<camel:simple>
                    ${in.header.rootName} == 'factura'</camel:simple>
					<camel:log message="firmando factura" />
					<camel:to
						uri="xmlsecurity:sign://enveloped?keyAccessor=#keyAccessor&amp;parentLocalName=factura" />
					<camel:log message="${body}" />
					<camel:to uri="xmlsecurity:verify://enveloped?keySelector=#keySelector" />
				</camel:when>
				<camel:when>
					<camel:simple>
                    ${in.header.rootName} == 'notaDebito'</camel:simple>
					<camel:log message="firmando notaDebito" />
					<camel:to
						uri="xmlsecurity:sign://enveloped?keyAccessor=#keyAccessor&amp;parentLocalName=notaDebito" />
					<camel:log message="${body}" />
					<camel:to uri="xmlsecurity:verify://enveloped?keySelector=#keySelector" />
				</camel:when>
				<camel:when>
					<camel:simple>
                    ${in.header.rootName} == 'comprobanteRetencion'</camel:simple>
					<camel:log message="firmando factura" />
					<camel:to
						uri="xmlsecurity:sign://enveloped?keyAccessor=#keyAccessor&amp;parentLocalName=comprobanteRetencion" />
					<camel:log message="${body}" />
					<camel:to uri="xmlsecurity:verify://enveloped?keySelector=#keySelector" />
				</camel:when>
			</camel:choice>

The first approach is the one I prefer, but it doesn't actually work as expected as the outside the "recipientList" the output body is the same as the input (i.e. no Signature node), but within the receipientList I can get the correctly signed content.

Although the second approach works, it's really messy because there's too much duplicate code due to the same problem described before, as also the signed content (body) is only present within the when tags, and not on the outside/end of the whole choice tag.

A workaround would be to redirect inside the recipientList to another route using a direct uri, but my doubt is if this is a bug in the xmlsecurity endpoint, am I doing something wrong or something else?

Attached is the whole spring/camel xml file for you to review.

Regards,
Gonzalo Vásquez Sáez
Gerente Investigación y Desarrollo (R&D)
Altiuz Soluciones Tecnológicas de Negocios Ltda.
Av. Nueva Tajamar 555 Of. 802, Las Condes - CP 7550099
+56 2 335 2461
gvasquez@altiuz.cl
http://www.altiuz.cl
http://www.altiuzreports.com
  


Re: xmlsecurity endpoint output not "lasting"!?!?!?

Posted by Willem Jiang <wi...@gmail.com>.
Hi Gonzalo,

I’m glade that you find a way to solve the problem with Camel.
Please keep in mind reporting bugs could make Camel even better :)

--  
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 November 12, 2014 at 10:57:14 PM, Gonzalo Vasquez (gvasquez@altiuz.cl) wrote:
> Willem,
>  
> Switching to 2.15-SNAPSHOT made my day, as it provides support for the parentXpath parameter  
> in the xmlsecurity endpoint. Although documentation is not correct as it says that the  
> parentXpath has a String argument, it's not correct, as it expects a javax.xml.crypto.dsig.spec.XPathFilterParameterSpec  
> parameter, that can be instantiated using something like:
>  
>  
>  
>  
>  
> And the later referenced using the pound sign (#) in the endpoint declaration as in:
>  
> > />
>  
> Using this parameter I no longer need to create nor a dynamic endpoint, nor a choice/when  
> condition, so I've managed to implement a workaround for the reported issue. If I happen  
> to have sometime I'll make a test case and submit it to Jira.
>  
> Regards,
>  
> Gonzalo Vásquez Sáez
> Gerente Investigación y Desarrollo (R&D)
> Altiuz Soluciones Tecnológicas de Negocios Ltda.
> Av. Nueva Tajamar 555 Of. 802, Las Condes - CP 7550099
> +56 2 335 2461
> gvasquez@altiuz.cl
> http://www.altiuz.cl
> http://www.altiuzreports.com
>  
>  
>  
> El 12-11-2014, a las 7:46, Willem Jiang escribió:
>  
> > Here are some information about it.
> > If you can still reproduce the error, you can create a JIRA[2] and submit a small test  
> case for it.
> >
> >
> > [1]http://camel.apache.org/maven-2-snapshot-repository-in-pom.html
> > [2]http://issues.apache.org/jira/browse/CAMEL
> >
> > --
> > 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 November 12, 2014 at 6:03:45 PM, Gonzalo Vasquez (gvasquez@altiuz.cl) wrote:
> >> Hi, I'm using 2.14.0, as I haven't been able to find a newer with Maven, is
> >> there a special repository for snapshots?
> >>
> >> On Wednesday, November 12, 2014, Willem Jiang
> >> wrote:
> >>
> >>> Hi
> >>>
> >>> Which version of Camel are you using?
> >>> I cannot reproduce the error with Apache Camel master branch (Camel
> >>> 2.15-SNAPSHOT).
> >>>
> >>> Regards,
> >>>
> >>> --
> >>> 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 November 12, 2014 at 6:20:13 AM, Gonzalo Vasquez (gvasquez@altiuz.cl
> >>> ) wrote:
> >>>> Hi everybody,
> >>>>
> >>>> I'm having trouble with the output of the xmlsecurity endpoint. I
> >>> suppose the obvious
> >>>> is to get the signed xml as in the body of the next endpoint, but it
> >>> seems a bit odd that it's
> >>>> only kept as is if where a "local variable" as used in formal
> >>> programming languages, such
> >>>> as variables defined in if/while/for loops, and no longer exists upon
> >>> exit.
> >>>>
> >>>>
> >>>> Have I been clear of what is happening, or am I too messy in the
> >>> explanation?
> >>>>
> >>>> What I need is to use an endpoint such as:
> >>>>
> >>>>> />
> >>>>
> >>>>
> >>>>
> >>>> As I need a flexible parentLocalName, I've tried two approaches:
> >>>>
> >>>>
> >>>>
> >>> xmlsecurity:sign://enveloped?keyAccessor=#keyAccessor&parentLocalName=${in.header.rootName}  
> >>>>
> >>>>
> >>>> And:
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> ${in.header.rootName} == 'factura'
> >>>>
> >>>>>
> >>> uri="xmlsecurity:sign://enveloped?keyAccessor=#keyAccessor&parentLocalName=factura"  
> >>>> />
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> ${in.header.rootName} == 'notaDebito'
> >>>>
> >>>>>
> >>> uri="xmlsecurity:sign://enveloped?keyAccessor=#keyAccessor&parentLocalName=notaDebito"  
> >>>> />
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> ${in.header.rootName} == 'comprobanteRetencion'
> >>>>
> >>>>>
> >>> uri="xmlsecurity:sign://enveloped?keyAccessor=#keyAccessor&parentLocalName=comprobanteRetencion"  
> >>>> />
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> The first approach is the one I prefer, but it doesn't actually work as
> >>> expected as the
> >>>> outside the "recipientList" the output body is the same as the input
> >>> (i.e. no Signature
> >>>> node), but within the receipientList I can get the correctly signed
> >>> content.
> >>>>
> >>>> Although the second approach works, it's really messy because there's
> >>> too much duplicate
> >>>> code due to the same problem described before, as also the signed
> >>> content (body) is only
> >>>> present within the when tags, and not on the outside/end of the whole
> >>> choice tag.
> >>>>
> >>>> A workaround would be to redirect inside the recipientList to another
> >>> route using a direct
> >>>> uri, but my doubt is if this is a bug in the xmlsecurity endpoint, am I
> >>> doing something wrong
> >>>> or something else?
> >>>>
> >>>> Attached is the whole spring/camel xml file for you to review.
> >>>>
> >>>> Regards,
> >>>> Gonzalo Vásquez Sáez
> >>>> Gerente Investigación y Desarrollo (R&D)
> >>>> Altiuz Soluciones Tecnológicas de Negocios Ltda.
> >>>> Av. Nueva Tajamar 555 Of. 802, Las Condes - CP 7550099
> >>>> +56 2 335 2461
> >>>> gvasquez@altiuz.cl
> >>>> http://www.altiuz.cl
> >>>> http://www.altiuzreports.com
> >>>>
> >>>>
> >>>>
> >>>
> >>>
> >>
> >
>  
>  


Re: xmlsecurity endpoint output not "lasting"!?!?!?

Posted by Gonzalo Vasquez <gv...@altiuz.cl>.
Willem,

Switching to 2.15-SNAPSHOT made my day, as it provides support for the parentXpath parameter in the xmlsecurity endpoint. Although documentation is not correct as it says that the parentXpath has a String argument, it's not correct, as it expects a javax.xml.crypto.dsig.spec.XPathFilterParameterSpec parameter, that can be instantiated using something like:

	<bean id="xpathNodoRaiz" class="javax.xml.crypto.dsig.spec.XPathFilterParameterSpec">
		<constructor-arg type="java.lang.String" value="/*[@id='comprobante']" />
	</bean>

And the later referenced using the pound sign (#) in the endpoint declaration as in:

	<camel:to uri="xmlsecurity:sign://enveloped?keyAccessor=#keyAccessor&amp;parentXpath=#xpathNodoRaiz" />

Using this parameter I no longer need to create nor a dynamic endpoint, nor a choice/when condition, so I've managed to implement a workaround for the reported issue. If I happen to have sometime I'll make a test case and submit it to Jira.

Regards,

Gonzalo Vásquez Sáez
Gerente Investigación y Desarrollo (R&D)
Altiuz Soluciones Tecnológicas de Negocios Ltda.
Av. Nueva Tajamar 555 Of. 802, Las Condes - CP 7550099
+56 2 335 2461
gvasquez@altiuz.cl
http://www.altiuz.cl
http://www.altiuzreports.com
  


El 12-11-2014, a las 7:46, Willem Jiang <wi...@gmail.com> escribió:

> Here are some information about it.
> If you can still reproduce the error, you can create a JIRA[2] and submit a small test case for it.
> 
> 
> [1]http://camel.apache.org/maven-2-snapshot-repository-in-pom.html
> [2]http://issues.apache.org/jira/browse/CAMEL
> 
> --  
> 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 November 12, 2014 at 6:03:45 PM, Gonzalo Vasquez (gvasquez@altiuz.cl) wrote:
>> Hi, I'm using 2.14.0, as I haven't been able to find a newer with Maven, is
>> there a special repository for snapshots?
>> 
>> On Wednesday, November 12, 2014, Willem Jiang  
>> wrote:
>> 
>>> Hi
>>> 
>>> Which version of Camel are you using?
>>> I cannot reproduce the error with Apache Camel master branch (Camel
>>> 2.15-SNAPSHOT).
>>> 
>>> Regards,
>>> 
>>> --
>>> 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 November 12, 2014 at 6:20:13 AM, Gonzalo Vasquez (gvasquez@altiuz.cl
>>> ) wrote:
>>>> Hi everybody,
>>>> 
>>>> I'm having trouble with the output of the xmlsecurity endpoint. I
>>> suppose the obvious
>>>> is to get the signed xml as in the body of the next endpoint, but it
>>> seems a bit odd that it's
>>>> only kept as is if where a "local variable" as used in formal
>>> programming languages, such
>>>> as variables defined in if/while/for loops, and no longer exists upon
>>> exit.
>>>> 
>>>> 
>>>> Have I been clear of what is happening, or am I too messy in the
>>> explanation?
>>>> 
>>>> What I need is to use an endpoint such as:
>>>> 
>>>>> />
>>>> 
>>>> 
>>>> 
>>>> As I need a flexible parentLocalName, I've tried two approaches:
>>>> 
>>>> 
>>>> 
>>> xmlsecurity:sign://enveloped?keyAccessor=#keyAccessor&parentLocalName=${in.header.rootName}  
>>>> 
>>>> 
>>>> And:
>>>> 
>>>> 
>>>> 
>>>> 
>>>> ${in.header.rootName} == 'factura'
>>>> 
>>>>> 
>>> uri="xmlsecurity:sign://enveloped?keyAccessor=#keyAccessor&parentLocalName=factura"  
>>>> />
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> ${in.header.rootName} == 'notaDebito'
>>>> 
>>>>> 
>>> uri="xmlsecurity:sign://enveloped?keyAccessor=#keyAccessor&parentLocalName=notaDebito"  
>>>> />
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> ${in.header.rootName} == 'comprobanteRetencion'
>>>> 
>>>>> 
>>> uri="xmlsecurity:sign://enveloped?keyAccessor=#keyAccessor&parentLocalName=comprobanteRetencion"  
>>>> />
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> The first approach is the one I prefer, but it doesn't actually work as
>>> expected as the
>>>> outside the "recipientList" the output body is the same as the input
>>> (i.e. no Signature
>>>> node), but within the receipientList I can get the correctly signed
>>> content.
>>>> 
>>>> Although the second approach works, it's really messy because there's
>>> too much duplicate
>>>> code due to the same problem described before, as also the signed
>>> content (body) is only
>>>> present within the when tags, and not on the outside/end of the whole
>>> choice tag.
>>>> 
>>>> A workaround would be to redirect inside the recipientList to another
>>> route using a direct
>>>> uri, but my doubt is if this is a bug in the xmlsecurity endpoint, am I
>>> doing something wrong
>>>> or something else?
>>>> 
>>>> Attached is the whole spring/camel xml file for you to review.
>>>> 
>>>> Regards,
>>>> Gonzalo Vásquez Sáez
>>>> Gerente Investigación y Desarrollo (R&D)
>>>> Altiuz Soluciones Tecnológicas de Negocios Ltda.
>>>> Av. Nueva Tajamar 555 Of. 802, Las Condes - CP 7550099
>>>> +56 2 335 2461
>>>> gvasquez@altiuz.cl  
>>>> http://www.altiuz.cl
>>>> http://www.altiuzreports.com
>>>> 
>>>> 
>>>> 
>>> 
>>> 
>> 
> 


Re: xmlsecurity endpoint output not "lasting"!?!?!?

Posted by Willem Jiang <wi...@gmail.com>.
Here are some information about it.
If you can still reproduce the error, you can create a JIRA[2] and submit a small test case for it.


[1]http://camel.apache.org/maven-2-snapshot-repository-in-pom.html
[2]http://issues.apache.org/jira/browse/CAMEL

--  
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 November 12, 2014 at 6:03:45 PM, Gonzalo Vasquez (gvasquez@altiuz.cl) wrote:
> Hi, I'm using 2.14.0, as I haven't been able to find a newer with Maven, is
> there a special repository for snapshots?
>  
> On Wednesday, November 12, 2014, Willem Jiang  
> wrote:
>  
> > Hi
> >
> > Which version of Camel are you using?
> > I cannot reproduce the error with Apache Camel master branch (Camel
> > 2.15-SNAPSHOT).
> >
> > Regards,
> >
> > --
> > 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 November 12, 2014 at 6:20:13 AM, Gonzalo Vasquez (gvasquez@altiuz.cl
> > ) wrote:
> > > Hi everybody,
> > >
> > > I'm having trouble with the output of the xmlsecurity endpoint. I
> > suppose the obvious
> > > is to get the signed xml as in the body of the next endpoint, but it
> > seems a bit odd that it's
> > > only kept as is if where a "local variable" as used in formal
> > programming languages, such
> > > as variables defined in if/while/for loops, and no longer exists upon
> > exit.
> > >
> > >
> > > Have I been clear of what is happening, or am I too messy in the
> > explanation?
> > >
> > > What I need is to use an endpoint such as:
> > >
> > > > />
> > >
> > >
> > >
> > > As I need a flexible parentLocalName, I've tried two approaches:
> > >
> > >
> > >
> > xmlsecurity:sign://enveloped?keyAccessor=#keyAccessor&parentLocalName=${in.header.rootName}  
> > >
> > >
> > > And:
> > >
> > >
> > >
> > >
> > > ${in.header.rootName} == 'factura'
> > >
> > > >
> > uri="xmlsecurity:sign://enveloped?keyAccessor=#keyAccessor&parentLocalName=factura"  
> > > />
> > >
> > >
> > >
> > >
> > >
> > > ${in.header.rootName} == 'notaDebito'
> > >
> > > >
> > uri="xmlsecurity:sign://enveloped?keyAccessor=#keyAccessor&parentLocalName=notaDebito"  
> > > />
> > >
> > >
> > >
> > >
> > >
> > > ${in.header.rootName} == 'comprobanteRetencion'
> > >
> > > >
> > uri="xmlsecurity:sign://enveloped?keyAccessor=#keyAccessor&parentLocalName=comprobanteRetencion"  
> > > />
> > >
> > >
> > >
> > >
> > >
> > > The first approach is the one I prefer, but it doesn't actually work as
> > expected as the
> > > outside the "recipientList" the output body is the same as the input
> > (i.e. no Signature
> > > node), but within the receipientList I can get the correctly signed
> > content.
> > >
> > > Although the second approach works, it's really messy because there's
> > too much duplicate
> > > code due to the same problem described before, as also the signed
> > content (body) is only
> > > present within the when tags, and not on the outside/end of the whole
> > choice tag.
> > >
> > > A workaround would be to redirect inside the recipientList to another
> > route using a direct
> > > uri, but my doubt is if this is a bug in the xmlsecurity endpoint, am I
> > doing something wrong
> > > or something else?
> > >
> > > Attached is the whole spring/camel xml file for you to review.
> > >
> > > Regards,
> > > Gonzalo Vásquez Sáez
> > > Gerente Investigación y Desarrollo (R&D)
> > > Altiuz Soluciones Tecnológicas de Negocios Ltda.
> > > Av. Nueva Tajamar 555 Of. 802, Las Condes - CP 7550099
> > > +56 2 335 2461
> > > gvasquez@altiuz.cl  
> > > http://www.altiuz.cl
> > > http://www.altiuzreports.com
> > >
> > >
> > >
> >
> >
>  


Re: xmlsecurity endpoint output not "lasting"!?!?!?

Posted by Gonzalo Vasquez <gv...@altiuz.cl>.
Hi, I'm using 2.14.0, as I haven't been able to find a newer with Maven, is
there a special repository for snapshots?

On Wednesday, November 12, 2014, Willem Jiang <wi...@gmail.com>
wrote:

> Hi
>
> Which version of Camel are you using?
> I cannot reproduce the error with Apache Camel master branch (Camel
> 2.15-SNAPSHOT).
>
> Regards,
>
> --
> 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 November 12, 2014 at 6:20:13 AM, Gonzalo Vasquez (gvasquez@altiuz.cl
> <javascript:;>) wrote:
> > Hi everybody,
> >
> > I'm having trouble with the output of the xmlsecurity endpoint. I
> suppose the obvious
> > is to get the signed xml as in the body of the next endpoint, but it
> seems a bit odd that it's
> > only kept as is if where a "local variable" as used in formal
> programming languages, such
> > as variables defined in if/while/for loops, and no longer exists upon
> exit.
> >
> >
> > Have I been clear of what is happening, or am I too messy in the
> explanation?
> >
> > What I need is to use an endpoint such as:
> >
> > > />
> >
> >
> >
> > As I need a flexible parentLocalName, I've tried two approaches:
> >
> >
> >
> xmlsecurity:sign://enveloped?keyAccessor=#keyAccessor&parentLocalName=${in.header.rootName}
> >
> >
> > And:
> >
> >
> >
> >
> > ${in.header.rootName} == 'factura'
> >
> > >
> uri="xmlsecurity:sign://enveloped?keyAccessor=#keyAccessor&parentLocalName=factura"
> > />
> >
> >
> >
> >
> >
> > ${in.header.rootName} == 'notaDebito'
> >
> > >
> uri="xmlsecurity:sign://enveloped?keyAccessor=#keyAccessor&parentLocalName=notaDebito"
> > />
> >
> >
> >
> >
> >
> > ${in.header.rootName} == 'comprobanteRetencion'
> >
> > >
> uri="xmlsecurity:sign://enveloped?keyAccessor=#keyAccessor&parentLocalName=comprobanteRetencion"
> > />
> >
> >
> >
> >
> >
> > The first approach is the one I prefer, but it doesn't actually work as
> expected as the
> > outside the "recipientList" the output body is the same as the input
> (i.e. no Signature
> > node), but within the receipientList I can get the correctly signed
> content.
> >
> > Although the second approach works, it's really messy because there's
> too much duplicate
> > code due to the same problem described before, as also the signed
> content (body) is only
> > present within the when tags, and not on the outside/end of the whole
> choice tag.
> >
> > A workaround would be to redirect inside the recipientList to another
> route using a direct
> > uri, but my doubt is if this is a bug in the xmlsecurity endpoint, am I
> doing something wrong
> > or something else?
> >
> > Attached is the whole spring/camel xml file for you to review.
> >
> > Regards,
> > Gonzalo Vásquez Sáez
> > Gerente Investigación y Desarrollo (R&D)
> > Altiuz Soluciones Tecnológicas de Negocios Ltda.
> > Av. Nueva Tajamar 555 Of. 802, Las Condes - CP 7550099
> > +56 2 335 2461
> > gvasquez@altiuz.cl <javascript:;>
> > http://www.altiuz.cl
> > http://www.altiuzreports.com
> >
> >
> >
>
>

Re: xmlsecurity endpoint output not "lasting"!?!?!?

Posted by Willem Jiang <wi...@gmail.com>.
Hi 

Which version of Camel are you using?
I cannot reproduce the error with Apache Camel master branch (Camel 2.15-SNAPSHOT).

Regards,

--  
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 November 12, 2014 at 6:20:13 AM, Gonzalo Vasquez (gvasquez@altiuz.cl) wrote:
> Hi everybody,
>  
> I'm having trouble with the output of the xmlsecurity endpoint. I suppose the obvious  
> is to get the signed xml as in the body of the next endpoint, but it seems a bit odd that it's  
> only kept as is if where a "local variable" as used in formal programming languages, such  
> as variables defined in if/while/for loops, and no longer exists upon exit.
>  
>  
> Have I been clear of what is happening, or am I too messy in the explanation?
>  
> What I need is to use an endpoint such as:
>  
> > />
>  
>  
>  
> As I need a flexible parentLocalName, I've tried two approaches:
>  
>  
> xmlsecurity:sign://enveloped?keyAccessor=#keyAccessor&parentLocalName=${in.header.rootName}  
>  
>  
> And:
>  
>  
>  
>  
> ${in.header.rootName} == 'factura'
>  
> > uri="xmlsecurity:sign://enveloped?keyAccessor=#keyAccessor&parentLocalName=factura"  
> />
>  
>  
>  
>  
>  
> ${in.header.rootName} == 'notaDebito'
>  
> > uri="xmlsecurity:sign://enveloped?keyAccessor=#keyAccessor&parentLocalName=notaDebito"  
> />
>  
>  
>  
>  
>  
> ${in.header.rootName} == 'comprobanteRetencion'
>  
> > uri="xmlsecurity:sign://enveloped?keyAccessor=#keyAccessor&parentLocalName=comprobanteRetencion"  
> />
>  
>  
>  
>  
>  
> The first approach is the one I prefer, but it doesn't actually work as expected as the  
> outside the "recipientList" the output body is the same as the input (i.e. no Signature  
> node), but within the receipientList I can get the correctly signed content.
>  
> Although the second approach works, it's really messy because there's too much duplicate  
> code due to the same problem described before, as also the signed content (body) is only  
> present within the when tags, and not on the outside/end of the whole choice tag.
>  
> A workaround would be to redirect inside the recipientList to another route using a direct  
> uri, but my doubt is if this is a bug in the xmlsecurity endpoint, am I doing something wrong  
> or something else?
>  
> Attached is the whole spring/camel xml file for you to review.
>  
> Regards,
> Gonzalo Vásquez Sáez
> Gerente Investigación y Desarrollo (R&D)
> Altiuz Soluciones Tecnológicas de Negocios Ltda.
> Av. Nueva Tajamar 555 Of. 802, Las Condes - CP 7550099
> +56 2 335 2461
> gvasquez@altiuz.cl
> http://www.altiuz.cl
> http://www.altiuzreports.com
>  
>  
>