HTTP/1.0 200 OK
Date: Thu, 01 Dec 2016 08:33:29 GMT
Server: WSGIServer/0.1 Python/2.7.12
X-Frame-Options: SAMEORIGIN
Content-Type: text/xml
And the process code is :
from django.shortcuts import render
from django.http import HttpResponse
import xml.etree.ElementTree as ET
import re
# Create your views here.
from .forms import AddForm
ns = {'SOAP-ENV':'http://schemas.xmlsoap.org/soap/envelope/', \
'SOAP-ENC':'http://schemas.xmlsoap.org/soap/encoding/', \
'xsi':'http://www.w3.org/2001/XMLSchema-instance', \
'xsd':'http://www.w3.org/2001/XMLSchema','cwmp':'urn:dslforum-org:cwmp-1-0'}
def index(request):
if request.method == 'POST':
#print('===================START=======================')
#print(request.body)
root = ET.fromstring(request.body)
#print('===================END=======================')
body = root.find('SOAP-ENV:Body', ns)
inform = body.find('cwmp:Inform', ns)
header = root.find('SOAP-ENV:Header', ns)
idObj = header.find('cwmp:ID', ns)
#print idObj.text
#s = request.session()
#print s
return render(request, 'tools/cwmpInformResponse.html', {'cwmpID': idObj.text},content_type='text/xml')
else:
form = AddForm()
return render(request, 'tools/index.html', {'form': form})
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/dc133975-8bf2-48fc-b32b-5868874f687e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment