Error With Kegg Api Sample Code For Python
2
1
Entering edit mode
11.3 years ago
JRCX ▴ 10

Hello!

I'm new in programming, coming from Engineering background. When trying to run KEGG APi sample code for Python in Pycharm (first do pip install SOAPpy)

#!/usr/bin/env python

from SOAPpy import WSDL

wsdl = 'http://soap.genome.jp/KEGG.wsdl'
serv = WSDL.Proxy(wsdl)

results = serv.get_genes_by_pathway('path:eco00020')
print results

I get the following error on the line serv = WSDL.Proxy(wsdl):

Traceback (most recent call last):
File "<console>", line 1, in <module>
  File "C:\Python27\lib\site-packages\SOAPpy\WSDL.py", line 85, in __init__
    self.wsdl = reader.loadFromString(str(wsdlsource))

  File "C:\Python27\lib\site-packages\wstools\WSDLTools.py", line 47, in loadFromString
    return self.loadFromStream(StringIO(data))

  File "C:\Python27\lib\site-packages\wstools\WSDLTools.py", line 28, in loadFromStream
    document = DOM.loadDocument(stream)

  File "C:\Python27\lib\site-packages\wstools\Utility.py", line 645, in loadDocument
    return xml.dom.minidom.parse(data)

  File "C:\Python27\lib\xml\dom\minidom.py", line 1914, in parse
    return expatbuilder.parse(file)

  File "C:\Python27\lib\xml\dom\expatbuilder.py", line 928, in parse
    result = builder.parseFile(file)

  File "C:\Python27\lib\xml\dom\expatbuilder.py", line 207, in parseFile
    parser.Parse(buffer, 0)

ExpatError: not well-formed (invalid token): line 1, column 5

Can someone please help me with it? Thanks in advance.

python • 4.5k views
ADD COMMENT
0
Entering edit mode

I can confirm that I get the same error. I'm looking into it to see if I can find a solution, but maybe file a bug already with KEGG?

ADD REPLY
4
Entering edit mode
11.3 years ago

It's not a programming problem: the URL of the WSDL ( http://soap.genome.jp/KEGG.wsdl ) seems wrong from here :

Access forbidden! (403)

see also: http://www.genome.jp/kegg/soap/

The current SOAP-based API service has not been updated for five years (see ChangeLog) and has become obsolete in certain aspects. Because the original developer is no longer with us at KEGG, we have decided to move to the new service with a much simpler design. The old service will continue to be accessible for six months, until December 31, 2012.

ADD COMMENT
0
Entering edit mode
11.3 years ago
Leandro Lima ▴ 970

Well... just to help.

www.vision.ime.usp.br/~llima/KEGG.wsdl

Please download. If you want, it's possible to do it with a local file.

serv = WSDL.Proxy('KEGG.wsdl')

ADD COMMENT
1
Entering edit mode

Dear Joana, use it only if you're in a hurry. But I recommend you to do like Pierre said (using REST).

ADD REPLY

Login before adding your answer.

Traffic: 2788 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6