2012-01-02 2 views
1

Android 브라우저 (Android 2.2)에서 html5로 간단한 웹 서비스를 호출하기 위해 노력하고 있습니다. Android 브라우저에서 작동하지 않습니다. 하지만 PC에서 실행하면 작동합니다. 버튼을 클릭해도 아무런 변화가 없습니다. 나는 지금 2 주 동안 그물에 있었다. 그러나, 일할 아무것도 얻지 않았다. 아래는 html 페이지의 코드입니다. 도와주세요.Android 브라우저에서 웹 서비스 호출 문제가 발생했습니다.

<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> 

감사합니다. 감사합니다.

답변

1

당신의 HTML은 http://localhost:2913

난 당신이 웹 서비스는 안드로이드 폰에서 실행이 있다고 생각 해달라고 동일한 시스템에서 서비스를 참조합니다.

내가 서버 IP 주소로 "localhost"를 교체하려고 서버

+0

의 IP와 localhost를 교체합니다. 그러나 작동하지 않았습니다. – user1082868

+0

은 안드로이드 폰에서 연결할 수있는 서버입니까? 즉, html-broser 전화에서 귀하의 서비스에 대한 html 페이지를 얻을 수 있습니까? – k3b

+0

에뮬레이터에서 코드를 실행 중입니다. Android 에뮬레이터에로드 된 html 페이지에서 웹 서비스를 호출하려고하면 아무 일도 발생하지 않습니다. – user1082868

관련 문제