HTTPUtils2 Library

jtnicholson

Member
Licensed User
Longtime User
My app is currently sending a HTTP job twice, but not every time.

I have multiple activities where an Upload activity gets called. I call it using CallSubDelayed(Upload,"InitializeUpload"), which initializes both the httpjob and a B4aServer task.

There is a button that you then click to upload the data. I even disabled the button once you clicked it to ensure that you couldn't click the button twice.

The button then calls a sub and uses the HTTPUtils2 library to post a string to an aspx page on a local network, which then uploads it to a SQL server internally. It also sends two files through the b4aserver to a local server. The b4a process works great, I don't get doubles on that.

Within the upload sub i even created a sql statement to update a column within the database to mark the record as uploaded, put the number 3 in it. So if the sub was being called twice, the initial sql statement has a where clause so that only records with the number 1 will be brought into the cursor, to then upload to the server.

Has anyone experienced this type of behavior?

Thanks
 

mc73

Well-Known Member
Licensed User
Longtime User
Some time ago, I experienced a multiple run of sql insertions,instead of just one, still, can't remember right now, where the problem was, even I don't remember if it was really solved. I'll give it another test, and I'll get back if same thing happens occasionally. I think that the problem was a multiple call to httpUtils2, yet not sure :(
 
Upvote 0

jtnicholson

Member
Licensed User
Longtime User
So could it be that when i call PostString i have to call it as;

B4X:
job1.PostString(ServerUrl&strVar1,ServerUrl&strVar)

because i notice in the library that within the sub the following is called.

B4X:
req.InitializePost2(Link, Data)
CallSubDelayed2(HttpUtils2Service, "SubmitJob", Me)

and I'm wondering if by send the ServerURL and the string variable both in the link and data is causing this error.
 
Upvote 0
Top