arskom/rpclib — Issue #112: ByteArray does not support binary
Author: Bluehorn
Created: 2011-11-28 16:38:08+00:00
State: open

I just tried to transfer binary data via rpclib and failed.

My problem is easily described: Returning binary data for ByteArray results in errors when creating the SOAP message. Try this:

$ python -c 'print "".join(map(chr, xrange(256)))' > /tmp/test.dat
$ cd rpclib/examples
$ python binary_soap.py

Now run a SUDS client against this:

```python
from suds.client import Client
c = Client("http://localhost:7789/?wsdl")
c.service.get("/tmp/test.dat")
```

I get the following traceback:

torsten@sharokan:~/opensrc/rpclib/examples$ python binary_soap.py
listening to http://127.0.0.1:7789
wsdl is at: http://localhost:7789/?wsdl
DEBUG:rpclib.protocol.soap.soap11:Unicode strings with encoding declaration are not supported. -- falling back to str decoding.
Traceback (most recent call last):
File "/usr/lib/python2.6/wsgiref/handlers.py", line 93, in run
self.result = application(self.environ, self.start_response)
File "/usr/local/lib/python2.6/dist-packages/rpclib-2.4.6_beta-py2.6.egg/rpclib/server/wsgi.py", line 168, in __call__
return self.__handle_rpc(req_env, start_response)
File "/usr/local/lib/python2.6/dist-packages/rpclib-2.4.6_beta-py2.6.egg/rpclib/server/wsgi.py", line 235, in __handle_rpc
self.get_in_object(ctx, in_string_charset)
File "/usr/local/lib/python2.6/dist-packages/rpclib-2.4.6_beta-py2.6.egg/rpclib/server/_base.py", line 53, in get_in_object
self.app.in_protocol.create_in_document(ctx, in_string_charset)
File "/usr/local/lib/python2.6/dist-packages/rpclib-2.4.6_beta-py2.6.egg/rpclib/protocol/soap/soap11.py", line 142, in create_in_document
ctx.in_document = _parse_xml_string(ctx.in_string, charset)
File "/usr/local/lib/python2.6/dist-packages/rpclib-2.4.6_beta-py2.6.egg/rpclib/protocol/soap/soap11.py", line 83, in _parse_xml_string
root, xmlids = etree.XMLID(xml_string)
File "xmlid.pxi", line 18, in lxml.etree.XMLID (src/lxml/lxml.etree.c:88052)
File "lxml.etree.pyx", line 2512, in lxml.etree.XML (src/lxml/lxml.etree.c:48057)
File "parser.pxi", line 1545, in lxml.etree._parseMemoryDocument (src/lxml/lxml.etree.c:71812)
File "parser.pxi", line 1424, in lxml.etree._parseDoc (src/lxml/lxml.etree.c:70673)
File "parser.pxi", line 938, in lxml.etree._BaseParser._parseDoc (src/lxml/lxml.etree.c:67442)
File "parser.pxi", line 539, in lxml.etree._ParserContext._handleParseResultDoc (src/lxml/lxml.etree.c:63824)
File "parser.pxi", line 625, in lxml.etree._handleParseResult (src/lxml/lxml.etree.c:64745)
File "parser.pxi", line 565, in lxml.etree._raiseParseError (src/lxml/lxml.etree.c:64088)
XMLSyntaxError: PCDATA invalid Char value 7, line 1, column 152
localhost - - [28/Nov/2011 17:08:19] "POST /?wsdl HTTP/1.1" 500 59

This is for rpclib-2.4.6-beta.