0
I have a SOAP service in my local system. I have implimented the Java Script code and tested in internet browser, it's working fine but the same code I am using for android application development using phoneGap, I am not getting any response from Android simulator.

問題を見つけるのを手伝ってください。

//Function called in button click.
function getEmpDetails() {
var e_id = $("#empID").val();
alert("e_id :"+e_id );
var url = "http://localhost:5020/EmployeeService";
var envelope = "<soap:Envelope xmlns:soap='http://www.w3.org/2003/05/soap-envelope'xmlns:inp='http://InputMessageNamespace'>";             
envelope += "<soap:Header/>";
envelope += "<soap:Body>";
envelope += "<inp:EmployeeDetailsOperation>";
envelope += "<EmployeeId>"+e_id+"</EmployeeId>";
envelope += "</inp:EmployeeDetailsOperation>";
envelope += "</soap:Body>";
envelope += "</soap:Envelope>";
$.ajax({
url: url, 
type: "POST",
dataType: "xml",
contentType: "text/xml;charset=UTF-8",
data: envelope,
beforeSend: function(xhr) { xhr.setRequestHeader("SOAPAction", "/Process Definition"); },
success: OnSuccess,
error: OnError
});
};
function OnSuccess(data, status)     
{
alert(status);
alert(data.xml);
}      
function OnError(request, status, error)     
{         
alert('error');
} 
function init() {
alert("init");
document.addEventListener("deviceready", deviceInfo, true);
}
4

1 に答える 1

1
  • 「localhost:5020」をローカル(プライベート)IPアドレス「192.168.xx:5020」に置き換えます。AVDはマシン開発Webサーバーに接続します。Windowsでip-config/allを実行するか、Linuxディストリビューションでifconfigを実行して、urlocal-ipを確認します。

    アンドロイドエミュレータとローカルサイト

于 2012-04-05T11:39:50.197 に答える