1

I have been using SUDS and RPCLib to develop a SOAP interface to a software solution that takes a PDF document and returns a PNG, and have found a very interesting problem.

I have written the testing client (using SUDS) and server (using RPCLib), and they work successfully when when the documents to be uploaded and returned are less than about 3.5Mb. However, when uploading larger documents I get the SUDS Error:

Traceback (most recent call last):
  File "MyFunc.py", line 90, in <module>
    callMyFuncSOAPService(fName, test_id, fNameOut)
  File "MyFuncClient.py", line 77, in callMyFuncSOAPService
    temp_list = client.service.createInstance(encoded_data, 19, test_id, 20)
  File "/usr/local/lib/python2.7/dist-packages/suds/client.py", line 542, in __call__
    return client.invoke(args, kwargs)
  File "/usr/local/lib/python2.7/dist-packages/suds/client.py", line 602, in invoke
    result = self.send(soapenv)
  File "/usr/local/lib/python2.7/dist-packages/suds/client.py", line 637, in send
    reply = transport.send(request)
  File "/usr/local/lib/python2.7/dist-packages/suds/transport/https.py", line 64, in send
    return  HttpTransport.send(self, request)
  File "/usr/local/lib/python2.7/dist-packages/suds/transport/http.py", line 77, in send
    fp = self.u2open(u2request)
  File "/usr/local/lib/python2.7/dist-packages/suds/transport/http.py", line 118, in u2open
    return url.open(u2request, timeout=tm)
  File "/usr/lib/python2.7/urllib2.py", line 400, in open
    response = self._open(req, data)
  File "/usr/lib/python2.7/urllib2.py", line 418, in _open
'_open', req)
  File "/usr/lib/python2.7/urllib2.py", line 378, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 1207, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "/usr/lib/python2.7/urllib2.py", line 1177, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error [Errno 32] Broken pipe>

And when returning a document, the Server finishes processing and returns the document, but the Client hangs.

I have a feeling that this is due to a limit in the HTTP transport layer, but have no idea how to address this. Thanks!

Namingwaysway
  • 270
  • 1
  • 17

2 Answers2

2

You could just increase your allowed request length.

app = WsgiApplication(...)
app.max_content_length = 10 * 0x100000 # 10 MB

Spyne 2.10 and 2.9.4 will have these parameters in the constructor, so you'll be able to just do this:

WsgiApplication(..., max_content_length=10 * 0x100000)
Burak Arslan
  • 7,671
  • 2
  • 15
  • 24
0

I found a possible solution. It involved updating to and editing the spyne library [the successor to rpclib].

in WSGI.py, function __wsgi_input_to_iterable(), I commented out the 2 lines that threw the error:

raise RequestTooLongError()

The problem is that we are pulling a limit from length = str(http_env.get('CONTENT_LENGTH', self.max_content_length)) that seems to be incorrect.

I will check with the SPYNE developers to see what this bug could be coming from

Namingwaysway
  • 270
  • 1
  • 17