SOAPPy helloworld-ish problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pion
    New Member
    • Jun 2008
    • 2

    SOAPPy helloworld-ish problem

    Hello

    I'm trying to make a web service client in python, and so to start out, I found this simple example that are supposed to parse an wsdl file using SOAPPy. I'm using Windows and got SOAPPy installed using the Enthought Python Distribution. I've tried several wsdl files and commenting out parts of the code etc. but I just can't twist my head around what's the problem here. Any help would be greatly appreciated.

    soappyTest.py:
    Code:
    from SOAPpy import WSDL
    
    url = 'GoogleSearch.wsdl' # from http://api.google.com/GoogleSearch.wsdl
    
    # just use the path to the wsdl of your choice
    wsdlObject = WSDL.Proxy(url + '?WSDL')
    
    print 'Available methods:'
    for method in wsdlObject.methods.keys() :
      print method
      ci = wsdlObject.methods[method]
      # you can also use ci.inparams
      for param in ci.outparams :
        # list of the function and type 
        # depending of the wsdl...
        print param.name.ljust(20) , param.type
      print
    output at command prompt / terminal:
    Code:
    Traceback (most recent call last):
      File "C:\jostein\matlab_med_webservice\soappyTest.py", line 6, in <module>
        wsdlObject = WSDL.Proxy(url + '?WSDL')
      File "C:\Python25\lib\site-packages\soappy-0.11.6.0001-py2.5-win32.egg\SOAPpy\WSDL.py", line 67, in __init__
        self.wsdl = reader.loadFromString(str(wsdlsource))
      File "C:\Python25\lib\site-packages\soappy-0.11.6.0001-py2.5-win32.egg\SOAPpy\wstools\WSDLTools.py", line 47, in loadFromString
        return self.loadFromStream(StringIO(data))
      File "C:\Python25\lib\site-packages\soappy-0.11.6.0001-py2.5-win32.egg\SOAPpy\wstools\WSDLTools.py", line 28, in loadFromStream
        document = DOM.loadDocument(stream)
      File "C:\Python25\lib\site-packages\soappy-0.11.6.0001-py2.5-win32.egg\SOAPpy\wstools\Utility.py", line 572, in loadDocument
        return xml.dom.minidom.parse(data)
      File "C:\Python25\lib\site-packages\pyxml-0.8.4.0002-py2.5-win32.egg\_xmlplus\dom\minidom.py", line 1915, in parse
        return expatbuilder.parse(file)
      File "C:\Python25\lib\site-packages\pyxml-0.8.4.0002-py2.5-win32.egg\_xmlplus\dom\expatbuilder.py", line 930, in parse
        result = builder.parseFile(file)
      File "C:\Python25\lib\site-packages\pyxml-0.8.4.0002-py2.5-win32.egg\_xmlplus\dom\expatbuilder.py", line 207, in parseFile
        parser.Parse(buffer, 0)
    xml.parsers.expat.ExpatError: syntax error: line 1, column 0
    Thanks in advance for any help!
Working...