有沒有一種快速驗證SOAP消息的方法?我看過JSON對象的驗證器。有沒有像這樣的SOAP?我正在接收我正在處理的AJAX文章中的'錯誤的請求:400'錯誤響應。我不太熟悉SOAP,因爲我通常只是通過JSON。有人能告訴我我的請求有什麼問題,或者建議自己調試嗎? Firebug錯誤消息只是'錯誤的請求:400',這並沒有真正的幫助。如何驗證SOAP請求
<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>
這是我的POST功能:
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);
}
});
}
此外,查看線路併發布實際發送的完整XML。 – 2009-12-11 23:27:23