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

Attachment: spring-ws-servlet.xml
Description: XML document

Reply via email to