problem with google api / xml

R

robin

hello,

i installed SOAPpy 0.12.0 and pyXML 0.8.4 in order to try out the
google-search example in diveintopython
http://diveintopython.org/soap_web_services/index.html
however, i'v been trying and trying and won't get it to work :-(
whenever i run this code, i get the attached exception...

from SOAPpy import WSDL
WSDLFILE = '/pathtomy/googleapi/GoogleSearch.wsdl'
APIKEY = '....'
_server = WSDL.Proxy(WSDLFILE)

any help would be very much appreciated!
thanks in advance,
robin

Traceback (most recent call last):
File "<stdin>", line 1, in ?
File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/SOAPpy/WSDL.py",
line 67, in __init__
self.wsdl = reader.loadFromString(str(wsdlsource))
File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/SOAPpy/wstools/WSDLTools.py",
line 47, in loadFromString
return self.loadFromStream(StringIO(data))
File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/SOAPpy/wstools/WSDLTools.py",
line 28, in loadFromStream
document = DOM.loadDocument(stream)
File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/SOAPpy/wstools/Utility.py",
line 602, in loadDocument
return xml.dom.minidom.parse(data)
File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/_xmlplus/dom/minidom.py",
line 1915, in parse
return expatbuilder.parse(file)
File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/_xmlplus/dom/expatbuilder.py",
line 930, in parse
result = builder.parseFile(file)
File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/_xmlplus/dom/expatbuilder.py",
line 207, in parseFile
parser.Parse(buffer, 0)
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 1,
column 0
 
M

Mike Kent

robin said:
from SOAPpy import WSDL
WSDLFILE = '/pathtomy/googleapi/GoogleSearch.wsdl'
APIKEY = '....'
_server = WSDL.Proxy(WSDLFILE)

Robin, note this part of the URI set in WSDLFILE:
'/pathtomy/googleapi'. Get it? 'path to my google api'. You must set
this part to the actual path where the file 'GoogleSearch.wsdl' is
found. In addition, doesn't APIKEY = '....' look a bit odd to you?
Hmm, what could this mean. APIKEY. Perhaps you need to get an API key
from Google in order to use their search API, and fill it in there?

;-)
 
R

robin

hi kent,

thanks for your reply. in fact it was me who put "pathtomy" into the
path and exchanged my apikey with "...."
i prefer not everyone to know the name of my directories and even less
my apikey. so the problem isn't there :-(
hope to find some other solution....
thanks!!

robin
 
J

John Bokma

robin said:
hello,

i installed SOAPpy 0.12.0 and pyXML 0.8.4 in order to try out the
google-search example in diveintopython
http://diveintopython.org/soap_web_services/index.html
however, i'v been trying and trying and won't get it to work :-(
whenever i run this code, i get the attached exception...

from SOAPpy import WSDL
WSDLFILE = '/pathtomy/googleapi/GoogleSearch.wsdl'
[...]

ackages/_xmlplus/dom/expatbuilder.py", line 207, in parseFile
parser.Parse(buffer, 0)
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 1,
column 0

Did you check your GoogleSearch.wsdl file? From the error I guess that
something is wrong with the file itself. I Recommend to check it, or
download it again:

http://api.google.com/GoogleSearch.wsdl

No experience with SOAPpy, but with SOAP::Lite (Perl), I can give the uri
to that file (OTOH, hosting it localy might be faster).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top