Junk after XML (0 at the end of reply)
I am finally back to programming and I am currently working in providing Web Processing Service.
I started to use PyWPS implementation for it (it is very well done, complements to Jachym Cepicky) but PyWPS runs as a CGI script and not from inside mod_python, the possibility of running it using the cgihandler from mod_python is a limited option.....
So I am making a new version of PyWPS crafted to my needs, I managed to get a Request=GetCapabilities working, but I got stuck with this error:
XML Parsing Error: junk after document element
Location: http://localhost/test/wps/wps2.py/main?version=0.4.0&Request=GetCapabilities
Line Number 104, Column 1:0
^
0
Well it seems there is an "extra" after the XML document, the problem is related to the req object of mod_python and how the HTTP is processed.
This 0 indicates that there is no more HTTP chunks (more or less EOF).
To disable chunked encoding, it is necessary to specify content length:
req.send_http_header()
req.content_type = 'text/xml'
req.set_content_length(len(getCapabilities.document.toprettyxml()))
req.write(getCapabilities.document.toprettyxml())
return apache.OK
The getCapabilities.document.toprettyxml() creates my XML document that then is checked for lenght, after it will be flushed with req.write
0 Comments:
Post a Comment
<< Home