我想使用ksoap2作为android的soap web服务。
我使用http://www.helloandroid.com/tutorials/using-ksoap2-android-and-parsing-output-data这个例子从ksoap2开始。导入最新文件并粘贴此代码时

     private static final String SOAP_ACTION = "http://footballpool.dataaccess.eu/data/TopGoalScorers";
 private static final String NAMESPACE = "http://footballpool.dataaccess.eu";
 private static final String URL = "http://footballpool.dataaccess.eu/data/info.wso?WSDL";


    public SoapObject soap(String METHOD_NAME, String SOAP_ACTION, String NAMESPACE, String URL) throws IOException, XmlPullParserException {
   SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); //set up request
   request.addProperty("iTopN", "5"); //variable name, value. I got the variable name, from the wsdl file!
   SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); //put all required data into a soap envelope
   envelope.setOutputSoapObject(request);  //prepare request
   AndroidHttpTransport httpTransport = new AndroidHttpTransport(URL);
   httpTransport.debug = true;  //this is optional, use it if you don't want to use a packet sniffer to check what the sent message was (httpTransport.requestDump)
   httpTransport.call(SOAP_ACTION, envelope); //send request
   SoapObject result=(SoapObject)envelope.getResponse(); //get response
   return result;
}

呼叫
SoapObject result=soap(METHOD_NAME, SOAP_ACTION, NAMESPACE, URL);

我收到此错误(显示错误示例):
不推荐使用AndroidHttpTransport类型
有人能告诉我哪里错了吗??
谢谢

最佳答案

你所学的教程已经过时了。用HttpTransportSE代替AndroidHttpTransport

关于android - Android ksoap2 Web服务弃用错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/5239518/

10-11 05:20