views:

98

answers:

2

Hi folks,

I am wondering if I could use simply use HTTP POST Requests in order to implement a SOAP API.

If so how should I format and treat the requests?

+3  A: 

Yes, see http://www.w3schools.com/SOAP/soap_httpbinding.asp

A SOAP method is an HTTP request/response that complies with the SOAP encoding rules.

HTTP + XML = SOAP

A SOAP request could be an HTTP POST or an HTTP GET request.

You'll sometimes find other transport mechanisms used for quality of service reasons, for instance using a messaging framework.

Garethr
+3  A: 

Yep, I have done this in certain cases where SOAPpy did not work with a given schema. This should get you started.

import httplib
from xml.dom import minidom

http.request("POST", "/path/to/my/webservice", body=xml, headers = {
    "Host": "myservername",
    "Content-Type": "text/xml; charset=UTF-8",
    "Content-Length": len(xml)
})

print minidom.parseString(http.getresponse().read())

For the content string, I would use SoapUI to make the requests manually, and then mimic the XML.

Chase Seibert