简体   繁体   中英

Post-request error with Spyne and Django-silk

I am already using spyne-RPC as a SOAP server within Django. I have installed django-silk to monitor requests. For my GET requests it works ok but when i use POST i get the error below and a timeout. If I remove django-silk it works ok. there is an issue at django.py of spyne at

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.

I briefly mention this in the documentation: 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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