Is there a quick method to validate SOAP messages efficiently? I have come across validators for JSON objects, but is there anything similar for SOAP? I keep receiving a 'Bad Request: 400' error response with an AJAX post I am trying to implement. SOAP is not my usual format as I usually deal with JSON. Can someone please help me identify the issue with my request or suggest effective debugging methods? The Firebug error message simply states 'Bad Request: 400', which is not very informative.
<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>
<UpdateAutoChart xmlns='http://somewhere.org/hwconnect/services' soap:encodingStyle='http://schemas.xmlsoap.org/soap/encoding'>alertid=Test&companytoken=hw&autochart=false</UpdateAutoChart>
</soap:Body>
</soap:Envelope>
This snippet shows my POST function:
function doPost(method, body) {
var soapRequest = "<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' ";
soapRequest = soapRequest + "xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>";
soapRequest = soapRequest + "<soap:Body>"
soapRequest = soapRequest + "<" + method + " xmlns='http://somewhere.org/hwconnect/services' soap:encodingStyle='http://schemas.xmlsoap.org/soap/encoding'>";
soapRequest = soapRequest + body;
soapRequest = soapRequest + "</" + method + ">";
soapRequest = soapRequest + "</soap:Body></soap:Envelope>";
jQuery.noConflict();
jQuery.ajax({
beforeSend: function(xhrObj) {
xhrObj.setRequestHeader("Method", "POST");
xhrObj.setRequestHeader("Content-Type", "text/xml; charset=\"utf-8\";");
xhrObj.setRequestHeader("SOAPAction", "http://somewhere.org/hwconnect/services/" + method);
},
async: false,
type: "POST",
url: theURL,
contentType: "text/xml; charset=\"utf-8\";",
data: soapRequest,
error: function(XMLHttpRequest, textStatus, errorThrown) {
alert("XMLHttpRequest Failure: " + XMLHttpRequest.statusText);
}
});
}