def get_post_response(dom, request):
id_text = dom.find('Body/GetPost/id').text
post = MemoryDb.get_post(id_text, get_ip(request))
if not post:
raise exception_response(404)
resp_xml = """<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetPostResponse xmlns="http://tempuri.org/">
<GetPostResult>
<Id>{}</Id>
<Title>{}</Title>
<Published>{}</Published>
<Content>{}</Content>
<ViewCount>{}</ViewCount>
</GetPostResult>
</GetPostResponse>
</soap:Body>
</soap:Envelope>""".format(post.id, post.title, post.published, post.content, post.view_count)
return Response(body=resp_xml, content_type='text/xml')
blog_soap.py 文件源码
python
阅读 21
收藏 0
点赞 0
评论 0
评论列表
文章目录