Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

ParseXml, "Premature end of file" error

New Here ,
Jul 01, 2010 Jul 01, 2010

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!

10.6K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jul 07, 2010 Jul 07, 2010

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 07, 2010 Jul 07, 2010

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...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 07, 2010 Jul 07, 2010

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>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jul 08, 2010 Jul 08, 2010

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 08, 2010 Jul 08, 2010
LATEST

I'm seeing the same behavior as you with my Coldfusion Web Service.  Possibly a bug in GetHTTPRequestData function in CF?  References:

http://www.bennadel.com/blog/1602-GetHTTPRequestData-Breaks-The-SOAP-Request-Response-Cycle-In-ColdF...

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources