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
gvasq...@altiuz.cl
http://www.altiuz.cl
http://www.altiuzreports.com
  


El 12-11-2014, a las 7:46, Willem Jiang <willem.ji...@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 (gvasq...@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 (gvasq...@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
>>>> gvasq...@altiuz.cl  
>>>> http://www.altiuz.cl
>>>> http://www.altiuzreports.com
>>>> 
>>>> 
>>>> 
>>> 
>>> 
>> 
> 

Reply via email to