Android Question Httpjob.PostString has inconsistent behaviour

hbahra

New Member
Licensed User
Longtime User
Hope somebody can explain this

If I enter this URL in my browser

http://md5.jsontest.com/?text=example_text

I get the expected response

{
"md5": "fa4c6baa0812e5b5c80ed8885e55a8a6",
"original": "example_text"
}

The following code works as expected on the same URL, returning the above response and Job.Success = True

B4X:
Sub Activity_Create(FirstTime As Boolean)
   Dim job1 As HttpJob
   job1.Initialize("Job1", Me)
   job1.PostString("http://md5.jsontest.com/", "text=example_text")  'works as expected
End Sub

Sub JobDone (Job As HttpJob)
   Log("JobName = " & Job.JobName & ", Success = " & Job.Success)
   If Job.Success = True Then
      Select Job.JobName
         Case "Job1"
            Log(Job.GetString)
      End Select
   Else
      Log("Error: " & Job.ErrorMessage)
      ToastMessageShow("Error: " & Job.ErrorMessage, True)
   End If
   Job.Release
End Sub

All well and good so far.

If I repeat the experiment with a differeint URL,

http://www.songsterr.com/a/ra/songs.json?pattern=adel

The response in the browser is a long JSON string, starting

[{"id":398570,"type":"Song","title":"Weinen","artist":{"id":53119,"type":"Artist", ...

However, this PostString call

B4X:
   job1.PostString("http://www.songsterr.com/a/ra/songs.json", "pattern=adel")

returns Job.Success = False

What am I doing wrong? Any pointers would be appreciated
 

hbahra

New Member
Licensed User
Longtime User
Hi Erel,

Thanks for the instant response, complete log output follows.

LogCat connected to: 275501120005706
--------- beginning of /dev/log/system--------- beginning of /dev/log/main~i:** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Service (httputils2service) Create **
** Service (httputils2service) Start **
JobName = Job1, Success = false
Error: Apple

Not much to go on
 
Upvote 0

Similar Threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…