iOS Question HTTPUTILS2 Error 500

Indy

Active Member
Licensed User
Longtime User
Hi Erel,

When posting the string, is there a limit to the size of the string? I get an error when trying to upload a ~300K jpg file. I'm encoding the bytes to 64 bits. If I post a small file 1 or 2k it works fine. Problem when I try to view the string in the log file is the post string gets truncated so I cannot see the entire sent http post.

I used the equivalent version of this library in my Android project and that works ok with jpgs. I'm now converting my app to iOS but stuck on this final bit. The code I'm using is pretty much the code you have in your example. What I can't do is show the actual post string as it's being truncated and besides it's just be a load of hex code.

Thanks
 

Indy

Active Member
Licensed User
Longtime User
Hi Erel,

I use the HTTP upload as follows;

B4X:
Dim Job5b As HttpJob
Dim strFilterXML As String = "<soap:Body><UploadData xmlns=""http://web.xxxxx.xxxx.xxxxx/""><f>" & su.EncodeBase64(ReadFile(Main.ImagesDir,UploadFL.Get(UploadFL.Size-1))) & "</f><fn>" & UploadFL.Get(UploadFL.Size-1) & "</fn><DID>" & Main.DID & "</DID></UploadData></soap:Body>"

Job5b.Initialize("Job5b", Me)
Job5b.PostString("http://web.xxxxx.xxxx.xxxxx/webservice.asmx", XML.Replace("<soap:Body />", strFilterXML))   
Job5b.GetRequest.SetHeader("SOAPAction", "http://web.xxxxx.xxxx.xxxxx/UploadData")     
Job5b.GetRequest.SetHeader("Content-Type", "text/xml; charset=utf-8")

The above code works absolutely fine when uploading a small file. But as soon as I use a image file ~300kb the upload fails. FYI - I have exactly the same code in the Android version and that doesn't fail, although I must admit the image files are smaller because the resize function used seems to work better.

Can you see if there's anything I'm doing wrong?

Thanks
 
Upvote 0

Indy

Active Member
Licensed User
Longtime User
Hi Erel,

Thanks for your suggestion, which I will try. However, just as a test I exported the string to a text file anyway just to see if it was complete, which it was. So, wouldn't reading it in and sending it have the same effect I'm having now? Or is it File.Readstring different? I'm getting the feeling the string is too long. What do you think?

Thanks
 
Upvote 0

Indy

Active Member
Licensed User
Longtime User
Hi Erel,

Just as I suspected, using File.Readstring produced the same error. I definitely think string is too large for the message. The image is only 1024x768 but at ~300kb maybe it's just pipped past the max allowed message size.

I'm going to try the Android version again and save the string to a file and see how that compares and update you.

Thanks
 
Upvote 0
Top