kartagis / pysimplesoap

Automatically exported from code.google.com/p/pysimplesoap
0 stars 0 forks source link

Django integration #5

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
So far I used soaplib that integrate with django. I'm looking for the solution 
of how to integrate Django with pysimplesoap. Django as server SOAP (WSDL). I 
mean the integration with authentication and django views. Django is currently 
one of the most popular Python frameworks.

Original issue reported on code.google.com by rafb...@gmail.com on 23 Aug 2010 at 8:15

GoogleCodeExporter commented 8 years ago
The dispatcher is similar to SimpleXMLRPC, so it should be possible to 
integrate with any framework or web server: 
http://code.google.com/p/pysimplesoap/wiki/SoapDispatcher

I have no plans (nor time) to do this work, I know Django is a good framework 
but currently I'm using web2py, you can see how it was integrated:
http://code.google.com/p/pysimplesoap/wiki/Web2Py

Anyway, if you need further advice or have code changes, I'll glad to assist 
you and/or review/accept the patches.

Original comment by reingart@gmail.com on 2 Sep 2010 at 4:55

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
# A simple views.py file sample for dispatcher
from pysimplesoap.server import SoapDispatcher
from django.http import HttpResponse

# just a remote function ;)
def func(data):
    return data

# dispatcher declaration: however you like to declare it ;)
dispatcher = SoapDispatcher(
    'my_dispatcher',
    location = "http://localhost:8000/soap",
    action = 'http://localhost:8000/soap',
    namespace = "http://blah.blah.org/blah/blah/local",
    prefix="bl1",
    ns = "bl2")

# register func
dispatcher.register_function('func', func,
    returns={'result': str}, 
    args={'data': str})

def dispatcher_handler(request):
    if request.method == "POST":
        response = HttpResponse(mimetype="application/xml")
        response.write(dispatcher.dispatch(request.raw_post_data))
    else:
        response = HttpResponse(mimetype="application/xml")
        response.write(dispatcher.wsdl())
    response['Content-length'] = str(len(response.content))
    return response

Original comment by d4r...@gmail.com on 9 Nov 2013 at 12:47

GoogleCodeExporter commented 8 years ago
The example was moved to [Django] wiki page, thanks!

Original comment by reingart@gmail.com on 22 Jan 2014 at 2:12