вызов веб-службы wcf Использование jquery - Ajax не удалось из-за неверного запроса, не зная точной проблемы. он даже не вызывает никаких методов успешным или неудачным. и веб-служба, и веб-сайт развертываются на одном сервере с использованием iis
ошибка:
Failed to load resource: the server responded with a status of 400 (Bad Request)
код используется для вызова методов службы:
function test(){
try {
code = getValuesWrittenInTheURL[0] + "";
var query = "select taskstatus,tasksubstatus,Lat,Lng,elementID from tasks_gvt where code = '" + code + "'";
$.ajax({
type: "POST",
async: true,
url: IP + "/GetData",
data: JSON.stringify({ Query: query }),
dataType: "json",
success: function (data) {
debugger;
console.log("data: ",data);
},
failure: function (errMsg) {
debugger;
console.log("err",errMsg);
}
});
} catch (error) {
console.log("alaaError", error.message);
}
}
Контракт на эксплуатацию веб-службы wcf:
[WebInvoke(Method = "POST", RequestFormat = WebMessageFormat.Json, UriTemplate = "GetData", BodyStyle = WebMessageBodyStyle.WrappedRequest)]
Response GetData(String Query);
готов предоставить вам более подробную информацию.