I have a problem with a Coldfusion webservice I've created. The service accepts XML data, BASE64 encoded, and then writes it to disk for archive purposes. This file then undergoes a basic schema check and any errors are reported back to the user as follows:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<UploadXMLResponse xmlns="http://url">
<UploadXMLReturn>
<AuthMessage>Authentication successful</AuthMessage>
<AuthStatus>Success</AuthStatus>
<FileInfo>File Example.xml was successfully uploaded</FileInfo>
<UploadStatus>Success</UploadStatus>
<xmlValErrors>
<xmlValErrors xsi:type="xsd:string">1824</xmlValErrors>
<xmlValErrors xsi:type="xsd:string">Error Message</xmlValErrors>
<xmlValErrors xsi:type="xsd:string">23</xmlValErrors>
<xmlValErrors xsi:type="xsd:string">1824</xmlValErrors>
<xmlValErrors xsi:type="xsd:string">Error Message</xmlValErrors>
<xmlValErrors xsi:type="xsd:string">38</xmlValErrors>
</xmlValErrors>
<xmlValMessage>Schema validation generated errors</xmlValMessage>
<xmlValStatus>Failure</xmlValStatus>
</UploadXMLReturn>
</UploadXMLResponse>
</soapenv:Body>
</soapenv:Envelope>
The problem is that the <xmlValErrors>
element is nested in a slightly weird way. This is due to the way Coldfusion handles the array of errors. The result is that when a user tries to analyse the reponse, they are only able to see the initial <xmlValErrors>
element.
.Net appears to be a particular problem here, as it sees the <xmlValErrors>
element as an empty array, even although it clearly contains numerous other elements.
I suspect the problem lays with the reuse of the name on the child elements within the <xmlValErrors>
element. However I have not been able to find a way around this in Coldfusion.
Thoughts on how this might be resolved would greatly appreciated.