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 将连接到机器开发网络服务器。在 Windows 上执行 ip-config/all 或在 linux 发行版上执行 ifconfig 以了解您的本地 IP。

    android模拟器和本地站点

于 2012-04-05T11:39:50.197 回答