D Derek Jee Active Member Licensed User Longtime User Aug 19, 2015 #1 Hi there Error 503 is a red herring.. I use a HTTPUtils2 to send HTTP requests to a server and await responses. I have a service triggering these requests periodically every 5 minutes. I do manually trigger the service on login and can trigger it with a button press. When I manually trigger the service by logging on or pressing the button I get the correct responses sent back 200 and 304.. but when I leave the device alone and let it run the service after setting StartServiceAt then the HTTP request is made but comes back with a 503 error. It seems not to send it from the device but just send it and not get a response so gives an error 503. I have a colleague who can see no trace of the request being sent from the device in Fiddler.. Can anyone advise what might be going wrong? Thank you, Derek. Last edited: Aug 20, 2015
Hi there Error 503 is a red herring.. I use a HTTPUtils2 to send HTTP requests to a server and await responses. I have a service triggering these requests periodically every 5 minutes. I do manually trigger the service on login and can trigger it with a button press. When I manually trigger the service by logging on or pressing the button I get the correct responses sent back 200 and 304.. but when I leave the device alone and let it run the service after setting StartServiceAt then the HTTP request is made but comes back with a 503 error. It seems not to send it from the device but just send it and not get a response so gives an error 503. I have a colleague who can see no trace of the request being sent from the device in Fiddler.. Can anyone advise what might be going wrong? Thank you, Derek.
DonManfred Expert Licensed User Longtime User Aug 19, 2015 #2 Derek Jee said: Can anyone advise what might be going wrong? Click to expand... Without seeing what yu did in code and how we cannot answer this. Can you upload a small project which shows the problem`? Upvote 0
Derek Jee said: Can anyone advise what might be going wrong? Click to expand... Without seeing what yu did in code and how we cannot answer this. Can you upload a small project which shows the problem`?
D Derek Jee Active Member Licensed User Longtime User Aug 19, 2015 #3 Hi Manfred I have just noticed something in my code which might help me explain a bit better. In the HTTPUtils2 service I added the following line in the hc_responseError sub.. I added the try catch with the job.tab = 503 when no response was sent back from the server. It does take 30 seconds for this error response to be made and I know nothing is being sent out. But a manual execution of the same code does send it.. I am thankful for your help but think I can't make a sample project at the moment. I just don't know why a service being started with a button press would act differently to it being started at a moment in time (5 minutes later in this instance). Thanks again, Derek. Code: Sub hc_ResponseError (Response As HttpResponse, Reason As String, StatusCode As Int, TaskId As Int) Try Dim job As HttpJob = TaskIdToJob.Get(TaskId) job.Tag = Response.StatusCode Catch job.Tag = 503 End Try Upvote 0
Hi Manfred I have just noticed something in my code which might help me explain a bit better. In the HTTPUtils2 service I added the following line in the hc_responseError sub.. I added the try catch with the job.tab = 503 when no response was sent back from the server. It does take 30 seconds for this error response to be made and I know nothing is being sent out. But a manual execution of the same code does send it.. I am thankful for your help but think I can't make a sample project at the moment. I just don't know why a service being started with a button press would act differently to it being started at a moment in time (5 minutes later in this instance). Thanks again, Derek. Code: Sub hc_ResponseError (Response As HttpResponse, Reason As String, StatusCode As Int, TaskId As Int) Try Dim job As HttpJob = TaskIdToJob.Get(TaskId) job.Tag = Response.StatusCode Catch job.Tag = 503 End Try
D Derek Jee Active Member Licensed User Longtime User Aug 20, 2015 #4 It appears I am getting error java.net.SocketTimeoutException on the subsequent requests which are 5 minutes apart. I have left the device alone for that period and it only works again if I interact and press my sync button to perform the request by running the service. The app is still active on the device. I cannot get a more detailed error though.. Upvote 0
It appears I am getting error java.net.SocketTimeoutException on the subsequent requests which are 5 minutes apart. I have left the device alone for that period and it only works again if I interact and press my sync button to perform the request by running the service. The app is still active on the device. I cannot get a more detailed error though..
Erel B4X founder Staff member Licensed User Longtime User Aug 20, 2015 #5 Error 503 is not a timeout error. Is there any error message in the logs? Upvote 0
D Derek Jee Active Member Licensed User Longtime User Aug 20, 2015 #6 Hi Erel You are right.. I noticed that last night hence the red herring message at the start of my question.. I added a 503 error to HTTPUtils2 to help me get a number if there was no response from the server I was requesting from.. So 503 is not the issue. I run a HTTP request every 5 minutes in a service. The requests fail to connect with a timeout error. The service I start runs a sub routine to make the request and after that code I StartServiceAt 5 minutes later.. But I think it is running that and stopping the code from my subroutine from executing because I am guessing it stops the service when the startAt is called.. I think I am not using them correctly but I cannot put my finger on it.. That is why I wanted to find someone who could help me for a small salary.. can you confirm if I run a sub from a service which makes a http request that it stops it when the StartServiceAT is called? Many thanks, Derek. Upvote 0
Hi Erel You are right.. I noticed that last night hence the red herring message at the start of my question.. I added a 503 error to HTTPUtils2 to help me get a number if there was no response from the server I was requesting from.. So 503 is not the issue. I run a HTTP request every 5 minutes in a service. The requests fail to connect with a timeout error. The service I start runs a sub routine to make the request and after that code I StartServiceAt 5 minutes later.. But I think it is running that and stopping the code from my subroutine from executing because I am guessing it stops the service when the startAt is called.. I think I am not using them correctly but I cannot put my finger on it.. That is why I wanted to find someone who could help me for a small salary.. can you confirm if I run a sub from a service which makes a http request that it stops it when the StartServiceAT is called? Many thanks, Derek.
DonManfred Expert Licensed User Longtime User Aug 21, 2015 #7 i think you should move the servicestartat call to your jobdone sub and call it after you have done your work (downloading the file). Upvote 0
i think you should move the servicestartat call to your jobdone sub and call it after you have done your work (downloading the file).
D Derek Jee Active Member Licensed User Longtime User Aug 21, 2015 #8 Thank you Manfred.. I did put the Start in my JobDone and it worked as expected. Thank you.. I guess putting it at the end of the service code stops any code initiated from it if you start it before the code has run. At lease I know. Have a great day. Derek. Upvote 0
Thank you Manfred.. I did put the Start in my JobDone and it worked as expected. Thank you.. I guess putting it at the end of the service code stops any code initiated from it if you start it before the code has run. At lease I know. Have a great day. Derek.