C cwt Active Member Licensed User Longtime User Dec 13, 2020 #1 I am creating an iOS app with B4i v6.80 and HttpJob v2.70 and HttpUtils2Service v2.70. Both HttpJob and HttpUtils2Service are being used as Code Modules. I am trying to use the code below, as taken from the example: Code: Copy Dim j As HttpJob j.Initialize("", Me) j.PostString(Main.ServerURL,PostString) Wait For (j) JobDone(j As HttpJob) If j.Success Then Log(j.GetString) End If j.Release If I comment out this line: "Wait For (j) JobDone(j As HttpJob)" the app does not crash and the POST is received by my web server. With the line not commented out the app crashes every time the code is called. Attached is the error log showing the error. Am I doing something wrong? Attachments Error Log.txt Error Log.txt 2.4 KB · Views: 557
I am creating an iOS app with B4i v6.80 and HttpJob v2.70 and HttpUtils2Service v2.70. Both HttpJob and HttpUtils2Service are being used as Code Modules. I am trying to use the code below, as taken from the example: Code: Copy Dim j As HttpJob j.Initialize("", Me) j.PostString(Main.ServerURL,PostString) Wait For (j) JobDone(j As HttpJob) If j.Success Then Log(j.GetString) End If j.Release If I comment out this line: "Wait For (j) JobDone(j As HttpJob)" the app does not crash and the POST is received by my web server. With the line not commented out the app crashes every time the code is called. Attached is the error log showing the error. Am I doing something wrong?
ilan Expert Licensed User Longtime User Dec 14, 2020 #2 i think the jobdone will be raised only by j.download function and not by j.PostString function. Last edited: Dec 14, 2020 Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Dec 14, 2020 #3 The code is correct. Don't use the code modules. Use iHttpUtils2 library. Upvote 0
C cwt Active Member Licensed User Longtime User Dec 14, 2020 #4 Erel, The reason I used the code module for HttpUtils2Service is that I need to change hc.Initialize("hc") to hc.InitializeAcceptAll("hc") so I do not have problems with the SSL certificate. Is there another way to do this? I get the below error if I do not "AcceptAll" certificates. This is on my test web server. On the production web server I am also connecting to an IP address rather than a domain name, so I must "AcceptAll" in any circumstance. ResponseError: The certificate for this server is invalid. You might be connecting to a server that is pretending to be “192.168.1.97” which could put your confidential information at risk., status code: 0 Last edited: Dec 14, 2020 Upvote 0
Erel, The reason I used the code module for HttpUtils2Service is that I need to change hc.Initialize("hc") to hc.InitializeAcceptAll("hc") so I do not have problems with the SSL certificate. Is there another way to do this? I get the below error if I do not "AcceptAll" certificates. This is on my test web server. On the production web server I am also connecting to an IP address rather than a domain name, so I must "AcceptAll" in any circumstance. ResponseError: The certificate for this server is invalid. You might be connecting to a server that is pretending to be “192.168.1.97” which could put your confidential information at risk., status code: 0
Erel B4X founder Staff member Licensed User Longtime User Dec 14, 2020 #5 cwt said: Is there another way to do this? Click to expand... Search Results www.b4x.com Upvote 0
C cwt Active Member Licensed User Longtime User Dec 14, 2020 #6 Okay - I removed the HttpJob and HttpUtils2Service modules and activated the libraries for each - to get around the SSL certificate error I temporarily made my webs server HTTP instead of HTTPS and now no errors. BUT - I need to set the POST content type in HttpJob to "text/xml" - how do I set the content type? And finally, how do I change the default timeout in HttpJob? Thanks. Upvote 0
Okay - I removed the HttpJob and HttpUtils2Service modules and activated the libraries for each - to get around the SSL certificate error I temporarily made my webs server HTTP instead of HTTPS and now no errors. BUT - I need to set the POST content type in HttpJob to "text/xml" - how do I set the content type? And finally, how do I change the default timeout in HttpJob? Thanks.
Erel B4X founder Staff member Licensed User Longtime User Dec 14, 2020 #7 cwt said: to get around the SSL certificate error I temporarily made my webs server HTTP instead of HTTPS and now no errors. Click to expand... I cannot help you if you ignore my answers. See the first search result. It takes exactly 10 seconds to enable "accept all". cwt said: BUT - I need to set the POST content type in HttpJob to "text/xml" - how do I set the content type? Click to expand... Use the search feature. It works very good: Search Results www.b4x.com Upvote 0
cwt said: to get around the SSL certificate error I temporarily made my webs server HTTP instead of HTTPS and now no errors. Click to expand... I cannot help you if you ignore my answers. See the first search result. It takes exactly 10 seconds to enable "accept all". cwt said: BUT - I need to set the POST content type in HttpJob to "text/xml" - how do I set the content type? Click to expand... Use the search feature. It works very good: Search Results www.b4x.com
C cwt Active Member Licensed User Longtime User Dec 14, 2020 #8 Erel, You misunderstood me - I pay attention to your answers and I fully intend to utilize your advice on "accept all" - but I am doing this one step at a time because I added my own code to the HttpJob module for setting the content type and timeout. And I always do a search for my questions before I post a question. I don't want to implement fixes that I do not understand. I have been using B4A for almost 5 years now and know the policies - converting my B4A app to B4i is taking a little time. Upvote 0
Erel, You misunderstood me - I pay attention to your answers and I fully intend to utilize your advice on "accept all" - but I am doing this one step at a time because I added my own code to the HttpJob module for setting the content type and timeout. And I always do a search for my questions before I post a question. I don't want to implement fixes that I do not understand. I have been using B4A for almost 5 years now and know the policies - converting my B4A app to B4i is taking a little time.