[Soap-Python] rpclib and Content-Length header?

Kevin Murphy kmurphy at mypublisher.com
Thu Mar 8 16:19:27 CET 2012


Hello,

I've written a SOAP service using rpclib 2.6.1-beta1 (originally with 2.5.2, same issue) and I'm noticing that the Content-Length header is never being set on the response from the application.

This is causing undesirable behavior when the application is mounted with uWSGI in Apache (sometimes Apache is adding the Transfer-Encoding: chunked header), so I'm attempting to figure out how I can correct this so that the Content-Length is always being set.  I noticed that protocol/soap/mime.py has code to deal with Content-Length, so to activate this I tried setting _mtom=True in my method decorator, but this led to a traceback first stating that out_object was being used before declaration in line 301 of server/wsgi.py.  I adjusted it thusly:

                out_object = ctx.out_object
                if len(out_type_info) == 1:
                    out_object = [out_object]

But then I get another traceback from the next line complaining that out_object is not iterable:

Traceback (most recent call last):
  File "/usr/local/pkg/python-2.7.2/lib/python2.7/site-packages/rpclib-2.6.1_mypub-py2.7.egg/rpclib/server/wsgi.py", line 200, in __call__
    return self._verb_handlers[verb](req_env, start_response)
  File "/usr/local/pkg/python-2.7.2/lib/python2.7/site-packages/rpclib-2.6.1_mypub-py2.7.egg/rpclib/server/wsgi.py", line 310, in handle_rpc
    out_object
  File "/usr/local/pkg/python-2.7.2/lib/python2.7/site-packages/rpclib-2.6.1_mypub-py2.7.egg/rpclib/protocol/soap/mime.py", line 249, in apply_mtom
    name, typ = params[i]
TypeError: 'ComplexModelMeta' object is not iterable

So... basically I'm guessing that I'm in uncharted territory here and this code must not get used often.  I'm not sure that the MtoM path is what I really need, I'm ultimately just trying to figure out how to get the Content-Length header set in the response message from the service.

Any thoughts on this?

Thanks!
--Kevin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/soap/attachments/20120308/234e8513/attachment.html>


More information about the Soap mailing list