Consume PHP/SOAP Webservice on Android

Asked

Viewed 474 times

0

I am developing an Android application that consumes a PHP webservice through ksoap2 library.

I am currently consulting the webservice with a class that extends an Asynctask. Only because she does the task in parallel with the UI Thread I’m having problems in the logic of the program.

Can I make the requests to the webservice in a normal class that does not extend an Asynctask?


The problem was that I was comparing the login data of my user object while from Asynctask was still updating this data. With this the user could not log in when entering their data. The solution was to make the comparison in Asynctask onPostExcute() very simple. Thank you for everyone’s input and it really is far better to perform heavy tasks on a separate thread.

  • Explain to us the problem you are having while running on a thread that it might be easier to make a suggestion.

  • I managed to solve the problem I will put an answer explaining.

2 answers

0

If you run the request in the Thread UI your application (i.e. screen) was stuck until the query returned from the server. This is not good practice leaving the usability of your application below expected!

I recommend you analyze the competition issue of your app instead of going to the UI Thread. Don’t be a believer in "religion" Extreme Go Horse - http://www.carlostristacci.com.br/blog/extreme-go-horse-xgh/

I hope I’ve helped!

0


You should not do this. You need to use a separate thread to handle network. For HTTP requests you can use the Okhttp/Retrofit or Volley libraries if you don’t feel comfortable implementing Asynctask

Browser other questions tagged

You are not signed in. Login or sign up in order to post.