/**
* 手機號段歸屬地查詢(模擬器、HTC 可以)
*
* @param phoneSec 手機號段
*/
public void getRemoteInfo() {
/*String phoneSec ="1860028";
// 命名空間
String nameSpace = "http://WebXml.com.cn/";
// 調用的方法名稱
String methodName = "getMobileCodeInfo";
// EndPoint
String endPoint = "http://webservice.webxml.com.cn/WebServices/MobileCodeWS.asmx";
// SOAP Action
String soapAction = "http://WebXml.com.cn/getMobileCodeInfo";*/
String nameSpace = "http://phone.centen.com";
String methodName = "LoginCertification";
String endPoint = "http://192.168.0.94:83/phoneService/services/PhoneWebService";
String soapAction = "http://phone.centen.com/LoginCertification";
// 指定WebService的命名空間和調用的方法名
SoapObject rpc = new SoapObject(nameSpace, methodName);
// 設置需調用WebService接口需要傳入的兩個參數mobileCode、userId
rpc.addProperty("userId", "系統管理員");
rpc.addProperty("psw", "123");
// 生成調用WebService方法的SOAP請求信息,並指定SOAP的版本
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER10);
envelope.bodyOut = rpc;
// 設置是否調用的是dotNet開發的WebService
envelope.dotNet = false;
// 等價於envelope.bodyOut = rpc;
envelope.setOutputSoapObject(rpc);
HttpTransportSE transport = new HttpTransportSE(endPoint);
try {
// 調用WebService
transport.call(soapAction, envelope);
} catch (Exception e) {
e.printStackTrace();
}
// 獲取返回的數據
SoapObject object = (SoapObject) envelope.bodyIn;
// 獲取返回的結果
String result = object.getProperty(0).toString();
System.err.println(">>>>>>>>>>>>>"+result);
}