我已经在Django中将spyne-RPC用作SOAP服务器。我已经安装了django-silk来监视请求。对于我的GET请求,它工作正常,但是当我使用POST时,出现以下错误和超时。如果我删除django-silk,就可以了。
的spyne的django.py出现问题response = WsgiApplication.__call__(self, environ, start_response)
以下是错误
Traceback (most recent call last):
File "/home/test/django/django-apps/venv-test/lib/python2.7/site-packages/django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
File "/home/test/django/django-apps/venv-test/lib/python2.7/site-packages/django/core/handlers/base.py", line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/home/test/django/django-apps/venv-test/lib/python2.7/site-packages/django/core/handlers/base.py", line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/test/django/django-apps/venv-test/lib/python2.7/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view
return view_func(*args, **kwargs)
File "/home/test/django/django-apps/venv-test/lib/python2.7/site-packages/spyne/server/django.py", line 89, in __call__
response = WsgiApplication.__call__(self, environ, start_response)
File "/home/test/django/django-apps/venv-test/lib/python2.7/site-packages/spyne/server/wsgi.py", line 304, in __call__
return self.handle_rpc(req_env, start_response)
File "/home/test/django/django-apps/venv-test/lib/python2.7/site-packages/spyne/server/wsgi.py", line 411, in handle_rpc
contexts = self.generate_contexts(initial_ctx, in_string_charset)
File "/home/test/django/django-apps/venv-test/lib/python2.7/site-packages/spyne/server/_base.py", line 64, in generate_contexts
self.app.in_protocol.create_in_document(ctx, in_string_charset)
File "/home/test/django/django-apps/venv-test/lib/python2.7/site-packages/spyne/protocol/soap/soap11.py", line 202, in create_in_document
charset)
File "/home/test/django/django-apps/venv-test/lib/python2.7/site-packages/spyne/protocol/soap/soap11.py", line 96, in _parse_xml_string
chunk = next(xml_string)
StopIteration
有什么想法吗?
答案 0 :(得分:0)
Probaby django-silk在返回值中消耗了生成器,而返回值没有为客户端留下任何数据。
我在文档中简要提到了这一点:http://spyne.io/docs/2.10/manual/03_types.html#arrays
...返回值可能是生成器,除非被使用,否则不得使用 将数据返回给客户端。这对于例如习俗 记录器,因为他们不应该尝试记录返回值(因为 将意味着消耗发电机)。
如果您可以自己消耗生成器并将其替换为具有相同数据的列表或元组,则可以正常工作。