С веб-страницы пытаюсь взаимодействовать с WCF-службой, хостом для которой является Windows-служба. Получаю "HTTP/1.1 400 Bad Request". Скрипт приведён ниже. Просьба помочь.
$(document).ready(function() {
$.ajax({
url: "http://localhost:8008/C_M_Service/GetCars",
datatype: "xml",
type: "POST",
contentType: "application/soap+xml; charset=utf-8",
data: "<id>1</id>",
error: function (err) {
alert("Error:"+err.toString());
},
success: function (data) {
$("#content").html(data);
}
});
});
Пытаюсь отправить так:
var t = 'POST /url HTTP/1.1\
Host: http://localhost:8008/C_M_Service\
Content-type: text/xml; charset=utf-8\
Content-length: 350\
SoapAction: http://localhost:8008/C_M_Service/GetCars\
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">\
<soap:Body>\
<GetCars xmlns="http://localhost:8008/C_M_Service/GetCars">\
<id>123</id>\
</GetCars>\
</soap:Body>\
</soap:Envelope>';
$(document).ready(function() {
$.ajax({
url: "http://localhost:8008/C_M_Service/GetCars",
datatype: "xml",
type: "POST",
contentType: "application/soap+xml; charset=utf-8",
data: t,
processData: false,
error: function (err) {
alert("Error:"+err.toString());
},
success: function (data) {
$("#content").html(data);
}
});
});
Получаю Bad request. Просьба помочь.
<id>1</id>
не нужно оборачивать в дополнительную обертку?