0
我已經創建了一個web服務來使用javacript提醒你好世界。但沒有結果。即使沒有錯誤。我無法弄清楚我犯的錯誤。我只是在本地託管wsdl。我錯過了什麼?提醒你好世界不工作
這裏是我的代碼
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Site.master.cs" Inherits="SiteMaster" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head runat="server">
<title></title>
<link href="~/css/style.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="/NetWebsite/js/jquery-1.10.2.js" ></script>
<script type="text/javascript" src="/NetWebsite/js/script.js" ></script>
<script language="JavaScript">
var iCallID;
function InitializeService(){
service.useService(http://localhost:5431/WebSite1/WebService.asmx?WSDL,"HelloWorldService");
service.HelloWorldService.callService("HellowWorld");
}
function ShowResult(){
alert(event.result.value);
}
</script>
<link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />
<asp:ContentPlaceHolder ID="HeadContent" runat="server">
</asp:ContentPlaceHolder>
</head>
<body onload="InitializeService()" id="service"
style="behavior:url(webservice.htc)" onresult="ShowResult()">
<form runat="server">
<div class="page">
<div class="main">
<asp:ContentPlaceHolder ID="MainContent" runat="server"/>
</div>
<div class="clear">
</div>
</div>
<div class="footer">
</div>
</form>
</body>
</html>
你確定服務實際上是在頁面加載時被調用嗎? –
我想通過點擊按鈕來調用服務。我喜歡這個 仍然無法正常工作 – dit1679