1
我從php頁面調用soap服務時遇到問題。我實現了兩頁,第一頁在php中創建,第二頁在asp.net中創建。在asp.net應用程序中,我有SOAP服務,應該從php調用哪些方法。在我的SOAP服務如何使用jQuery調用soap服務
方法,如下所示:
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public bool UpdateVotes(string vote) {
//Code
}
在PHP應用程序我呼籲UpdateVotes方法在下方式:
$.ajax({
type: "POST",
url: "http://localhost:5690/VoteServices.asmx/UpdateVotes",
data: "{'vote': '" + vote + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
},
error: function (xhr, status, error) {
}
});
首先我運行SOAP服務asp.net應用程序,並且比我開始php應用程序。
當我點擊鏈接調用Web方法服務,我的瀏覽器控制檯上我得到這個錯誤:
Failed to load resource: the server responded with a status of 500 (Internal Server Error) http://localhost:5690/VoteServices.asmx/UpdateVotes
XMLHttpRequest cannot load http://localhost:5690/VoteServices.asmx/UpdateVotes. Origin http://localhost:8080 is not allowed by Access-Control-Allow-Origin.
你谷歌的錯誤信息? – Gordon
Access-Control-Allow-Origin不允許訪問http:// localhost:8080原因 - 您應該閱讀JSONP,CORS - http://stackoverflow.com/questions/3616440/cross-origin-resource-sharing -cors - 使用 - JSONP-和網絡工作人員 – Tisho