0

Django 1.4 と Soaplib 2.0 に問題があります。

クライアントからいくつかの大きな引数を含むリクエストを送信すると、Django は例外を発生させ、次のタイプの電子メールを送信します: " [Django] ERROR (EXTERNAL IP): Internal Server Error: /uri/to/soap/service "

Traceback (most recent call last):
File "/path/to/my/project/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 129, in get_response
raise ValueError("The view %s.%s didn't return an HttpResponse object." % (callback.__module__, view_name))

ValueError: The view myproject/library.soap.wsgi.view didn't return an HttpResponse object.

サーバー側では、 http: //soaplib.github.io/soaplib/2_0/pages/helloworld.html#declaring-a-soaplib-service で入手できる通常の @soap デコレーターを使用します。

したがって、サーバー構成では次のようになります。

内部urls.py :

from myproject.server.webservice import WebService

application_view = Application([WebService], 'ws', name='ws').as_django_view()

urlpatterns = patterns(
     url(r'^soap/.*', csrf_exempt( application_view )),
)

myproject/server/webservice.py内:

 from soaplib.core.service import DefinitionBase
 class WebService(DefinitionBase):
     '''
     The actual webservice class.
     This defines methods exposed to clients.
     '''
     def __init__(self, environ):
         '''
         This saves a reference to the request environment on the current instance
         '''
         self.environ = environ
         super(WebService, self).__init__(environ)

     @soap(Array(Array(String)), _returns=Integer)
     def my_method(self, params):
         return self.process(params)

     def process(self, params):
         #DO SOMETHING HERE

クライアント側:

 #cfg is my configuration file
 #params is a dictionary 
 client = SoapClient(
                location = cfg.location,
                action = cfg.action, # SOAPAction
                namespace = cfg.namespace, #"http://example.com/sample.wsdl",
                soap_ns= cfg.soap_ns,
                trace = cfg.trace,
                ns = cfg.ns)
 response = client.my_method(params=params)

クライアントから非常に大きな辞書を送信しようとしましたが、うまくいきません。

Django がタイムアウトを設定し、プロセス中に接続を閉じていると思われます。とにかくタイムアウトを増やす方法はありますか、それとも何か他の原因で問題が発生していますか?

ちなみに、私はDjangoのみを使用しています。Apache または Nginx を構成しませんでした。

4

1 に答える 1