HTTP request failed, HTTP status: 504

904 Views Asked by At

I have an android application which I made with android studio and I use KSOAP2 library to access a WCFservice which I made by myself too. I'm facing a strange problem. I use the below code to create HttpTransportSE object and set timeOut on it:

HttpTransportSE transport = new HttpTransportSE(my_url + my_service + "/",120000);
transport.setReadTimeout(120000);

I can call any methods of WCF service without any problem. But when I call a method that takes longer than 30 seconds, it fails and return the below error by HttpTransportSE object:

HTTP request failed, HTTP status: 504

On my server side I set the CommandTimeout SqlCommand to 120 seconds. The stranger thing is that when I run the application on my real device with mobile data connection(No WiFi) I get the above error, But when I run it on the emulator of android studio (My PC have a WiFi connection) no error occurs and HttpTransportSE object returns the result in about 60 seconds successfully. I don't know what the problem is but i think my server and WCF service is correct because there is no error on the emulator. I guess there is a problem or some limitation in mobile data network.

0

There are 0 best solutions below