我一直在使用 SUDS 和 RPCLib 为软件解决方案开发 SOAP 接口,该软件解决方案采用 PDF 文档并返回 PNG,并且发现了一个非常有趣的问题。
我已经编写了测试客户端(使用SUDS)和服务器(使用RPCLib),当要上传和返回的文档小于3.5Mb时它们可以成功运行。但是,在上传较大的文档时,我收到 SUDS 错误:
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>
并且当返回一个文档时,Server 完成处理并返回该文档,但是 Client 挂起。
我有一种感觉,这是由于 HTTP 传输层的限制,但不知道如何解决这个问题。谢谢!