简体   繁体   English

Spyne和Django-silk的请求后错误

[英]Post-request error with Spyne and Django-silk

I am already using spyne-RPC as a SOAP server within Django. 我已经将spyne-RPC用作Django中的SOAP服务器。 I have installed django-silk to monitor requests. 我已经安装了django-silk来监视请求。 For my GET requests it works ok but when i use POST i get the error below and a timeout. 对于我的GET请求,它工作正常,但是当我使用POST时,出现以下错误和超时。 If I remove django-silk it works ok. 如果我删除django-silk,就可以了。 there is an issue at django.py of spyne at spyne的django.py处存在问题

response = WsgiApplication.__call__(self, environ, start_response)

the error is the following 错误如下

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

Any ideas? 有任何想法吗?

Probaby django-silk is consuming the generator in the return value which leaves no data for the client. 概率django-silk正在使用返回值中的生成器,该返回值不会为客户端留下任何数据。

I briefly mention this in the documentation: http://spyne.io/docs/2.10/manual/03_types.html#arrays 我在文档中简要提到了这一点: http : //spyne.io/docs/2.10/manual/03_types.html#arrays

... return value could be a generator and must not be consumed unless returning data to the client. ...返回值可能是生成器,除非将数据返回给客户端,否则不能使用返回值。 This comes in handy for, eg custom loggers because they should not try to log the return value (as that would mean consuming the generator). 这对于例如自定义记录器很方便,因为它们不应尝试记录返回值(因为这将消耗生成器)。

If you can somehow consume the generator yourself and replace it with a list or a tuple with the same data instead, it could work. 如果您可以自己消耗生成器并将其替换为具有相同数据的列表或元组,则可以正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM