Copy link to clipboard
Copied
I have made an online PDF submission script for a form on my site. For the most part, it has been working fine. However, over the past few days, I have gotten a number of error emails that I have setup with people having submission errors.
Here is what I am getting:
Error Type: Expression
Error Message: An error occured while Parsing an XML document.
Error Details: Premature end of file.
This is what I use to grab the XML:
<CFSET pdfXml=#ToString(GetHttpRequestData().Content)#>
<CFSET xmlData=#XmlParse(pdfXml)#>
These lines occur like the third or fourth line in the script, and the lines before it are for a CFTRY and another CFSET variable.
Any idea as to what might be causing this error? Since it works for 99% of the people, I think it is a problem with the system/server rather than the script...
Thanks in advance for any help with this!
Copy link to clipboard
Copied
Can you view the XML file in IE? What about Notepad - does it look ok? Usually having an invalid XML character (<>&") in the file results in other errors, but check on that possibility as well when you are looking at the file.
Copy link to clipboard
Copied
the way this is set up, the user is submitting a PDF form via Adobe Reader (sorry if I didn't make that very clear) and is getting a PDF response type back from the CF script. It really isn't easy to debug, and the way it is setup, there is no way to look at the xml.
i did have issues with & before, but it threw another error, and i think that when adobe reader sends its xml form data, it handles special character issues...
Copy link to clipboard
Copied
You first have to be sure it is XML. Verify with something like
<CFSET pdfXml=ToString(GetHttpRequestData().Content)>
Is it XML: <cfoutput>#isXML(pdfXml)#</cfoutput><br>
Content: <cfoutput>#xmlformat(pdfXml)#</cfoutput>
Copy link to clipboard
Copied
Try taking BKBK's idea and follow it with a CFFILE to write out the cotents of the XML file, so that you can look at it after the fact. Until you can actually look at it, and see what problems it has (if any), debugging is just going to be a lot of poking at it in the dark.
-reed
Copy link to clipboard
Copied
I'm seeing the same behavior as you with my Coldfusion Web Service. Possibly a bug in GetHTTPRequestData function in CF? References:
http://www.petefreitag.com/item/733.cfm
I'm trying to find workarounds for this problem too. If I find something I'll post it here.