SOAP web service with soaplib 2.0

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from soaplib.core import Application
from soaplib.core.server.wsgi import Application as WSGIApplication
from django.http import HttpResponse


class DjangoSoapApp(WSGIApplication):
    """
    Generic Django view for creating SOAP web services (works with soaplib 2.0)

    Based on http://djangosnippets.org/snippets/2210/
    """

    csrf_exempt = True

    def __init__(self, services, tns):
        """Create Django view for given SOAP soaplib services and tns"""

        return super(DjangoSoapApp, self).__init__(Application(services, tns))

    def __call__(self, request):
        django_response = HttpResponse()

        def start_response(status, headers):
            django_response.status_code = int(status.split(' ', 1)[0])
            for header, value in headers:
                django_response[header] = value

        response = super(DjangoSoapApp, self).__call__(request.META, start_response)
        django_response.content = '\n'.join(response)

        return django_response

More like this

  1. Convert django model into soaplib model, to expose webservices by s.federici 5 years, 3 months ago
  2. SOAP web service with soaplib 0.9+ by wRAR 3 years, 6 months ago
  3. django soaplib test client by erny 5 years ago
  4. SOAP views with on-demand WSDL generation by chewie 5 years, 8 months ago
  5. soaplib service integration 2 by erny 5 years ago

Comments

arasusara (on November 8, 2013):

I've seen this soaplib plugin does not evolve or documented properly. So failed!!!

#

(Forgotten your password?)