简体   繁体   中英

Android ksoap2 web service deprecated error

I want to use ksoap2 as SOAP web service for Android.

I use http://www.helloandroid.com/tutorials/using-ksoap2-android-and-parsing-output-data this example to begin with ksoap2. When import latest file and paste this code

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

call

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

I receive this error (example display error): The type AndroidHttpTransport is deprecated

Can some one tell me where I'm wrong??

Thanks

The tutorial you followed is outdated. Use HttpTransportSE in place of AndroidHttpTransport .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM