Hey.
Im trying to post some variables to an URL, but I get an error saying that
my XML is parsed incorrectly. I know that it is not. At closer inspection
I found out that some module in Python must be screwing up my request when
I try to send it.
Previously the code worked fine, but the problem occured when I included
the proxy/authentication code, so that must be what is messing around with
my request.
I substituted the original URL with a Zope script to post variable and
send them back to see what I get, testing it with and without the Proxy
code.
Here is the code:
#============== ============
import urllib2
infoRequest = "<GETCLIENTSERV ICES/>"
# VARIABLES TO SEND... it is the ArcXMLRequest that's going haywire!
params = urllib.urlencod e({'ArcXMLReque st': infoRequest,
'JavaScriptFunc tion':'processX ML',
'RedirectURL':' ',
'BgColor':'#000 000',
'FormCharset':' ISO-8859-1'})
proxy_info = {'port': 8080,
'host': '172.16.13.9',
'user': 'username',
'pass': 'password'}
proxy_support = urllib2.ProxyHa ndler({"http" :
"http://%(user)s:%(pass )s@%(host)s:%(p ort)s" %
proxy_info})
opener = urllib2.build_o pener(proxy_sup port, urllib2.HTTPHan dler)
urllib2.install _opener(opener)
req = urllib2.Request ('http://serverX/debugScript', params) # Zope
server, or ARCIMS Server
u = urllib2.urlopen (req)
print u.read()
#============== =============
http://serverX/debugScript only returns the ArcXMLRequest that was posted.
It should be :
"<GETCLIENTSERV ICES/>"
but instead I get :
"<GETCLIENTSERV ICES/%"
When I send "<GETCLIENTSERV ICES/>\n\n" instead of "<GETCLIENTSERV ICES/>",
I get back "<GETCLIENTSERV ICES/>\n%" as a result.
If I'm not clear enough about the problem, please shout. Help will be
appreciated!!
Thanks
Herman