See the Generating non-HTML content in the django book for instructions.
Basically, it's as simple as this:
def get_data(request, xml_data):
data = parse_xml_data(xml_data)
return_data = create_xml_blob(data)
return HttpResponse(return_data, mimetype='application/xml')
Edit:
You can send a post with xml_data set to the XML string, or you can send an XML request.
Here's some code for sending XML data to a web service, adapted from this site:
xml_data = """<?xml version="1.0" encoding="UTF-8"?>
<root>my data here</root>
"""
#construct and send the header
webservice = httplib.HTTP("example.com")
webservice.putrequest("POST", "/rcx-ws/rcx")
webservice.putheader("Host", "example.com")
webservice.putheader("User-Agent", "Python post")
webservice.putheader("Content-type", "text/xml; charset=\"UTF-8\"")
webservice.putheader("Content-length", "%d" % len(xml_data))
webservice.endheaders()
webservice.send(xml_data)
From django, you'd use request.raw_post_data
to get at the XML directly.