rancavil/tornado-webservices — Issue #10: Problem with suds client
Author: RANUX
Created: 2012-01-06 13:23:38+00:00
State: open

When i run CertService.py sample and try connect to soap service with suds client i got error "list index out of range".
suds version >= 0.4.
suds SOAP request:
```shell
>>> client.service.getCertificate('0-9')
DEBUG:suds.client:sending to (http://127.0.1.1:8080/CertService)
message:

0-9

DEBUG:suds.client:headers = {'SOAPAction': '"http://127.0.1.1:8080/CertService"', 'Content-Type': 'text/xml; charset=utf-8'}
DEBUG:suds.transport.http:sending:
URL:http://127.0.1.1:8080/CertService
HEADERS: {'SOAPAction': '"http://127.0.1.1:8080/CertService"', 'Content-Type': 'text/xml; charset=utf-8', 'Content-type': 'text/xml; charset=utf-8', 'Soapaction': '"http://127.0.1.1:8080/CertService"'}
MESSAGE:
0-9
DEBUG:suds.transport.http:received:
CODE: 200
HEADERS: {'content-length': '499', 'content-type': 'text/xml', 'server': 'TornadoServer/2.1.1'}
MESSAGE:

Error in web service : list index out of range

DEBUG:suds.client:http succeeded:

Error in web service : list index out of range

```
I found place where error occure
```python
def _parseSoap(self,xmldoc):
""" Private method parse a message soap from a xmldoc like string
_parseSoap() return a soap.SoapMessage().
"""
xmldoc = xmldoc.replace('\n',' ').replace('\t',' ').replace('\r',' ')
document = xml.dom.minidom.parseString(xmldoc)
prefix = document.documentElement.prefix # <-- SOAP-ENV
header = None
body = None
if prefix != None:
header = document.getElementsByTagName(prefix+':Header')
body = document.getElementsByTagName(prefix+':Body') # <-- ????
else:
header = document.getElementsByTagName('Header')
body = document.getElementsByTagName('Body')
```