Hi all, I'm developing a soap service with django 1.5.2, python 2.7.3 and soaplib 0.8.1. For now a simple method works fine but ... how i can add *xmlns* to response?
This is my view.py from sms.soaplib_handler import DjangoSoapApp, soapmethod, soap_typesfrom django.views.decorators.csrf import csrf_exempt class SmsGatewayService(DjangoSoapApp): __tns__ = 'http://tempuri.org' @soapmethod( soap_types.String, soap_types.String, soap_types.String, soap_types.Integer, soap_types.Boolean, soap_types.Boolean, soap_types.String, _returns=soap_types.Any ) def sendSms( self, sendTo, numSender, senderDescription, timeToLive, isDelivered, isStatistics, messageText ): retCode = '<retCode>OK</retCode>' return retCode sms_gateway_service = csrf_exempt(SmsGatewayService()) This is my soaplib_handler.py > from soaplib.wsgi_soap import SimpleWSGISoapApp > from soaplib.service import soapmethod > from soaplib.serializers import primitive as soap_types > from django.http import HttpResponse > > class DjangoSoapApp(SimpleWSGISoapApp): > def __call__(self, request): > django_response = HttpResponse() > def start_response(status, headers): > status, reason = status.split(' ', 1) > django_response.status_code = int(status) > for header, value in headers: > django_response[header] = value > response = super(SimpleWSGISoapApp, self).__call__(request.META, > start_response) > django_response.content = "\n".join(response) > return django_response and this is the response when i call the method: <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Body> <sendSmsResponse> <sendSmsResult> <retCode>OK</retCode> </sendSmsResult> </sendSmsResponse> </SOAP-ENV:Body></SOAP-ENV:Envelope> How i can modify a soap response? I need to have something similar to: <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Body> <sendSmsResponse xmlns="http://tempuri.org"> <retCode>OK</retCode> </sendSmsResponse> </SOAP-ENV:Body></SOAP-ENV:Envelope> I'm newbie to soaplib and newbie++ to django and python. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.