[英]Issue calling Web service from Android browser
I have been working on calling a simple web service in html5 from Android Browser(Android 2.2). 我一直在从Android浏览器(Android 2.2)调用html5中的简单Web服务。 Its not working on Android browser. 它不适用于Android浏览器。 But, it works if i run it on a PC. 但是,如果我在PC上运行它,它将起作用。 Nothing happens when i click the button. 当我单击按钮时,没有任何反应。 I have been on net for couple of weeks now. 我已经上网了几个星期了。 But, didn't get anything to work. 但是,没有任何工作。 Below is the code of the html page. 以下是html页面的代码。 please help. 请帮忙。
<html>
<head>
<title>UseSwap</title>
<script language="JavaScript">
function InitializeService(){
service.useService("http://localhost:2913/WebServicesUsingCSharp/WebService.asmx?wsdl",
"GetAgeService");
}
var StrYear, StrMonth, StrDay;
function GetAge(){
StrYear = document.DemoForm.StringYear.value;
StrMonth = document.DemoForm.StringMonth.value;
StrDay = document.DemoForm.StringDay.value;
service.GetAgeService.callService("GetAge", StrYear, StrMonth, StrDay);
}
function ShowResult(){
alert(event.result.value);
}
</script>
</head>
<body onload="InitializeService()" id="service"
style="behavior:url(webservice.htc)" onresult="ShowResult()">
<form name="DemoForm">
Year : <input type="text" name="StringYear"/>
Month : <input type="text" name="StringMonth"/>
Day : <input type="text" name="StringDay"/>
<button onclick="GetAge()">Get Age</button>
</form>
</body>
</html>
Regards, Parshant. 问候,帕桑特。
your html references a service on the same machine http://localhost:2913 您的html引用同一机器上的服务http:// localhost:2913
i dont think that you have the webservice running on your android phone. 我认为您的Android手机上没有运行网络服务。
replace localhost
with the ip of your server 用服务器的IP替换localhost
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.