java - Consume Web Service XML - NullPointerException -


i'm trying consume xml i'm getting nullpointerexception in line:

  inputstream = res.getentity().getcontent(); 

there's consume method , can check xml in url

public class xmldownloader {     defaulthttpclient client = new defaulthttpclient();     httpget method = new httpget("http://proapaplicativos.com.br/jccuritiba/listareventos.php");     httpresponse res = null;     nodelist result = null;    // thread t = new thread();      public nodelist getnodelist() throws interruptedexception{            //string url = "http://fiscalartesp.cloudapp.net/service1.svc/login?";          new thread(new runnable() {             public void run() {                  try {                     res = client.execute(method);                 } catch (clientprotocolexception e) {                     // todo auto-generated catch block                     e.printstacktrace();                 } catch (ioexception e) {                     // todo auto-generated catch block                     e.printstacktrace();                 }                 try{                     url urls;                     urls = new url("http://proapaplicativos.com.br/jccuritiba/listareventos.php");                     inputstream = res.getentity().getcontent();                     documentbuilderfactory dbf = documentbuilderfactory.newinstance();                     documentbuilder db = dbf.newdocumentbuilder();                     document doc = db.parse(new inputsource(urls.openstream()));                     doc.getdocumentelement().normalize();                     result = doc.getelementsbytagname("evento");                                              is.close();                 }catch(exception e){                      log.i("log_tag", "error converting result "+e.tostring());                 }                   }         }).start();         /*         new thread(new runnable() {             public void run() {          }).start();         */         while(result == null)         {             //log.i("aguardando", "aguardando resposta");         }           return result;                   } } 


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -