rancavil / tornado-webservices

A implementation of SOAP web services for tornado web server
www.innovaser.cl/innovaser.php
92 stars 32 forks source link

Problem with .net client #16

Open morsupil opened 11 years ago

morsupil commented 11 years ago

Hello,

I've this error return to a .net client : Error in web service : 'NoneType' object has no attribute 'replace'

I don't have the problem with soapui and suds.

Here is the traceback of the error:

Traceback (most recent call last): File "/usr/local/lib/python2.6/dist-packages/tornado/web.py", line 1042, in _execute getattr(self, self.request.method.lower())(_args, *_kwargs) File "/usr/local/lib/python2.6/dist-packages/tornadows/soaphandler.py", line 148, in post self._request = self._parseSoap(self.request.body) File "/usr/local/lib/python2.6/dist-packages/tornadows/soaphandler.py", line 229, in _parseSoap body_elements = self._parseXML(body) File "/usr/local/lib/python2.6/dist-packages/tornadows/soaphandler.py", line 265, in _parseXML elem_list.append(xml.dom.minidom.parseString(element.toxml())) File "/usr/lib/python2.6/xml/dom/minidom.py", line 45, in toxml return self.toprettyxml("", "", encoding) File "/usr/lib/python2.6/xml/dom/minidom.py", line 59, in toprettyxml self.writexml(writer, "", indent, newl) File "/usr/lib/python2.6/xml/dom/minidom.py", line 817, in writexml node.writexml(writer,indent+addindent,addindent,newl) File "/usr/lib/python2.6/xml/dom/minidom.py", line 812, in writexml _write_data(writer, attrs[a_name].value) File "/usr/lib/python2.6/xml/dom/minidom.py", line 301, in _write_data data = data.replace("&", "&").replace("<", "<") AttributeError: 'NoneType' object has no attribute 'replace'

The xml enveloppe send by the client is here:

http://pastebin.com/JnbrUWXj

Any Idea?

Michael

rancavil commented 11 years ago

Hello Michael. You can send me the SOAP message generated by the client .NET?.

I can see what this is an error of the xml parser in the API.

Thanks. Rodrigo.


De: morsupil notifications@github.com Para: rancavil/tornado-webservices tornado-webservices@noreply.github.com Enviado: Viernes, 12 de octubre, 2012 12:28 P.M. Asunto: [tornado-webservices] Problem with .net client (#16)

Hello, I've this error return to a .net client : Error in web service : 'NoneType' object has no attribute 'replace' I don't have the problem with soapui and suds. Here is the traceback of the error: Traceback (most recent call last): File "/usr/local/lib/python2.6/dist-packages/tornado/web.py", line 1042, in _execute getattr(self, self.request.method.lower())(_args, *_kwargs) File "/usr/local/lib/python2.6/dist-packages/tornadows/soaphandler.py", line 148, in post self._request = self._parseSoap(self.request.body) File "/usr/local/lib/python2.6/dist-packages/tornadows/soaphandler.py", line 229, in _parseSoap body_elements = self._parseXML(body) File "/usr/local/lib/python2.6/dist-packages/tornadows/soaphandler.py", line 265, in _parseXML elem_list.append(xml.dom.minidom.parseString(element.toxml())) File "/usr/lib/python2.6/xml/dom/minidom.py", line 45, in toxml return self.toprettyxml("", "", encoding) File "/usr/lib/python2.6/xml/dom/minidom.py", line 59, in toprettyxml self.writexml(writer, "", indent, newl) File "/usr/lib/python2.6/xml/dom/minidom.py", line 817, in writexml node.writexml(writer,indent+addindent,addindent,newl) File "/usr/lib/python2.6/xml/dom/minidom.py", line 812, in writexml _write_data(writer, attrs[a_name].value) File "/usr/lib/python2.6/xml/dom/minidom.py", line 301, in _write_data data = data.replace("&", "&").replace("<", "<") AttributeError: 'NoneType' object has no attribute 'replace' And the xml enveloppe send by the client: <?xml version="1.0" encoding="utf-8"?>soap:Body1411numericable/soap:Body/soap:Envelope Any Idea? Michael — Reply to this email directly or view it on GitHub.

rancavil commented 11 years ago

Sorry, did not see the link :-)

morsupil commented 11 years ago

no problem... I've test a cast in the xml parser module to force NoneType object to an str... No error after this modification but I don't think that this is the solution :-(((

morsupil commented 11 years ago

here is my modified writexml : def writexml(self, writer, indent="", addindent="", newl=""):

indent = current indentation

    # addindent = indentation to add to higher levels
    # newl = newline string
    writer.write(indent+"<" + self.tagName)
    attrs = self._get_attributes()
    a_names = attrs.keys()
    a_names.sort()
    for a_name in a_names:
        writer.write(" %s=\"" % a_name)
        _write_data(writer, str(attrs[a_name].value))
        writer.write("\"")
    if self.childNodes:
        writer.write(">%s"%(newl))
        for node in self.childNodes:
            node.writexml(writer,indent+addindent,addindent,newl)
        writer.write("%s</%s>%s" % (indent,self.tagName,newl))
    else:
        writer.write("/>%s"%(newl))