java - Error signing a soap request. Integrity lost -
i have generated class xjc , wsimport tools. have object attributes , elements need. have signaturetype object must contain sign of data send.
my root object looks this:
@xmlrootelement(name = "mensajepesadofirmadotipo") @xmlaccessortype(xmlaccesstype.field) @xmltype(name = "mensajepesadofirmadotipo", proporder = { "signature" }) public class mensajepesadofirmadotipo extends mensajepesadotipo { @xmlelement(name = "signature", namespace = "http://www.w3.org/2000/09/xmldsig#", required = true) protected signaturetype signature; ...
the process i'm doing is: fill information of mensajepesadofirmadotipo except signaturetype. next, unmarshall xml , use java xml signature api. marshall again , call ws.
i have integrity problem of sign because signed xml not same when marshall before call ws.
xml signed (signed ok):
<ns1:mensajepesadofirmadotipo xmlns:ns1="urn:correos.es:ape.sne.datos.1.0" xmlns:ns2="http://www.w3.org/2000/09/xmldsig#" modalidad="1" ns1:idref="idref" ns1:idunico="idunico" tipo="notificacion"> ... <ds:signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> ... </ds:signature></ns1:mensajepesadofirmadotipo>
resulting xml after marshal (integrity problem, de xml has change):
<ns1:mensajepesadofirmadotipo xmlns:ns1="urn:correos.es:ape.sne.datos.1.0" xmlns:ns2="http://www.w3.org/2000/09/xmldsig#" modalidad="1" ns1:idref="idref" tipo="notificacion" ns1:idunico="idunico"> ... <ns2:signature> ... </ns2:signature> </ns1:mensajepesadofirmadotipo>
how can make process ok?? please help!!!
thanks lot!!!
you didn't put details of signature (the complete ds:signature nodes). help.
depending on whether using xml canonicalization transforms or not signature may valid if xml after marshal not same before. xml canonicalization (google if not familiar it) mean used "canonicalize" xml input before computing signature. example, includes ordering attribute after canonicalization, mensajepesadofirmadotipo in both snippets give same input signature computation.
hope helps. moez
Comments
Post a Comment