Merge signed XML into another XML between CDATA element; any way: merge, repstr, i/o xmlinsert #xpa


Adrian Wick
 

Hello all,

has anyone done this? When i check the 1st xml for dig signature validation, it works. But when i put this 1st XML
into the 2nd one between the CDATA element, it breaks the signature and 0 signatures are detected. I asked for 
the example of the file and mine seems exactly the same, except it doesn't work. And that is the only help I got from
the web service provider ... "until the xml doesn't go trough the validator, it won't work. So fix your xml." that is the 
respond I got.

<Req xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<NDMDocument>
<Info date="2001-12-17T09:30:47.0Z"  document="111222333444">
<Person email="String" phone="String" surname="String"  name="String"/>
</Info>
<Subject>
<xmlSubject>
<![CDATA[ here goes the 2nd xml ]]]]><![CDATA[>
</xmlSubject>
</Subject>
</NDMDocument>
</Req>
If I validate 2nd xml, it works. But after adding it into the 1st xml the validator finds 0 signatures.

Any help is appreciated.

A


Steven Blank
 

Adrian,

Obviously, I know nothing about this web service, but I do see something odd about your syntax. Specifically, I see two extra square brackets in the first CDATA tag as well as an extra CDATA tag. I believe the line should look like this:

<![CDATA[ here goes the 2nd xml ]]>

<!{CDATA[ ]]> does not appear to require a closing tag. Was that why you included the second one?

Steven G. Blank
Ξ SGBlank Consulting


On 11/8/2022 8:20 AM, Adrian Wick wrote:

Hello all,

has anyone done this? When i check the 1st xml for dig signature validation, it works. But when i put this 1st XML
into the 2nd one between the CDATA element, it breaks the signature and 0 signatures are detected. I asked for 
the example of the file and mine seems exactly the same, except it doesn't work. And that is the only help I got from
the web service provider ... "until the xml doesn't go trough the validator, it won't work. So fix your xml." that is the 
respond I got.

<NDMDocument>
<Info date="2001-12-17T09:30:47.0Z"  document="111222333444">
<Person email="String" phone="String" surname="String"  name="String"/>
</Info>
<Subject>
<xmlSubject>
<![CDATA[ here goes the 2nd xml ]]]]><![CDATA[>
</xmlSubject>
</Subject>
</NDMDocument>
</Req>
If I validate 2nd xml, it works. But after adding it into the 1st xml the validator finds 0 signatures.

Any help is appreciated.

A


Adrian Wick
 

Well that's how it' done in the example. Last night i took some time to study CDATA and i also came across the same observation as you did Steven.
The sent file has two stages of validation. The 1st validation is on the data that is actually sent and the 2nd validation is the signature. The 1st validation
is ok, so the data sent is ok. The problem is the signature itself, which can't be found. I have checked that i do have the ID reference in the document and
than the same ID in the URI of the signature.

It is frustrating since i went line by line comparison between theirs example and mine. I can't find the difference in the structure. The sad part is that even
their example fails when trying to validate the xml file ...

I should have mentioned that at the end, the 1st xml is again put into another xml between CDATA ... So i have basically 3 xml files. 3rd goes into 2nd and 2nd
goes into 1st ... And the 3rd xml file has signature. And after merging the 3rd and 2nd, the validation fails ... 

I will try to do it without the closing tags.

Thank you.


Adrian Wick
 

I did it from scratch and this time I used only "Merge" with Output form. And I got it working. 

I lost 14 days, because the person at the helpdesk does not know what their web service does.
The validation needs to be done only on the 1st xml. It can not look inside of CDATA.