How can I use Basic Authentication with Spyne in Django? I attempted the below but it isn't working. I can view the WSDL page file fine, but I'm getting a 403 FORBIDDEN response whenever I actually try to call SayHello as a web service. I believe the 403 is CSRF related, but shouldn't the csrf_exempt get me around that? BTW, logged_in_or_basicauth is from this snippet: http://djangosnippets.org/snippets/243/ .
class CapsWebService(ServiceBase):
@rpc(String, Integer, _returns=Iterable(String))
def SayHello(ctx, name, times):
for i in xrange(times):
yield 'Hello, %s' % name
caps_web_service = csrf_exempt(DjangoApplication(Application(
[CapsWebService], 'solutions.sfcs', in_protocol=Soap11(), out_protocol=Soap11(), interface=Wsdl11(),
)))
@logged_in_or_basicauth()
def foo_view(request):
logger.debug('views.foo_view()')
return caps_web_service(request)