这是我的代码:
function DoAddAllCartItems(spaceID, colorID, themeID, width) {
$.ajax({
type: 'POST',
url: 'myservice.svc/AddAllCartItems',
data: "{spaceID: " + "'" + spaceID + "'" + ", colorID: " + "'" + colorID + "'" + ", themeID: " + "'" + themeID + "'" + ", width: " + "'" + width + "'" + "}",
contentType: "application/soap+xml; charset=utf-8",
dataType: "xml",
error: function () {
alert("Error");
},
success: function (response) {
alert(response);
}
});
}
[OperationContract]
[WebInvoke(Method = "POST",
BodyStyle = WebMessageBodyStyle.Wrapped,
ResponseFormat = WebMessageFormat.Json)]
string AddAllCartItems(int spaceID, int colorID, int themeID, int width);
答案 0 :(得分:0)
您需要提供更多信息。首先,在IIS中托管Web服务并连接Fiddler(http://www.fiddler2.com/fiddler2/)以查看从Web服务返回的内容。
我的第一个猜测是你的AddAllCartItems方法抛出异常。除此之外,可能是整数参数字符串化的问题吗?