Saturday, October 23, 2010

Re: serving SOAP service with soaplib, consuming with suds

Ricko -

You may have already gotten your answer. I believe your problem is
related to Django's CSRF protection. If that's the case, you'll want
to import csrf_exempt from django.views.decorators.csrf into your
views and then wrap the call to MySOAPService in it.

For example:

# views.py
from django.views.decorators.csrf import csrf_exempt

<snip>

my_soap_service = csrf_exempt(MySOAPService([DjangoSoapService],
DjangoSoapService.__tns__))

In my testing that seemed to work:

$ python2.5
Python 2.5.5 (r255:77872, Sep 7 2010, 10:18:54)
[GCC 4.0.1 (Apple Inc. build 5490)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from suds.client import Client

>>> client = Client("http://127.0.0.1:8000/hello_world/service.wsdl", cache=None, faults=False)
>>> response = client.service.hello_world(hello_string="hi")
>>> print response
(200, hi)

Let us know if that works for you.

--
Scott Hebert
http://slaptijack.com

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate