Android Question Response.GetString("UTF8") problem

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
hi
been away for some time...
just updated to 7.30 and reinstall the entire package.
have an app that is up & running and i need to make a few light modifications
so when opened the project i got this error - Response.GetString("UTF8")
been reading and saw that there are new libs ok...
tried to use the new libs but it made a lot of issues so i decided to roll back to my working code
how can i just overcome this issue ?

thanks
 

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
oh, god... either i'm too old for this or i'm too dumb
but i am missing something here

i created a sub for testing
it sends username and password to my webservice and gets back a ReturnCode
very basic and simple
but i can't make it work

can anyone please point me to the right way ?
many thanks



Sub btnTmpZeev_Click
ZeevUtils.Beep

Dim j As HttpJob
j.Initialize("", Me) 'name is empty as it is no longer needed

Dim sXML As String
Dim s As String=""

sXML = _
"<?xml version='1.0' encoding='utf-8'?>" & _
"<soap12:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap12='http://www.w3.org/2003/05/soap-envelope'>" & _
"<soap12:Body>" & _
"<GetCode xmlns='https://mywebsite.com/'>" & _
"<username>"&UserName&"</username>" & _
"<Password>"&Password&"</Password>" & _
"<ReturnCode/>" & _
"</GetCode>" & _
"</soap12:Body>" & _
"</soap12:Envelope>"

'j.PostBytes(URL,sXML)
j.PostBytes(URL,sXML.GetBytes("UTF8"))

Wait For (j) JobDone(j As HttpJob)
If j.Success Then
'The result is a json string. We parse it and log the fields.
Dim jp As JSONParser
jp.Initialize(j.GetString)
Dim RetValXml As List = jp.NextArray
For Each Line As Map In RetValXml
s = "ReturnCode: " & quot.Get("ReturnCode")
Next
Else
s = "Error-"& j.ErrorMessage

End If

j.Release

End Sub
 
Upvote 0

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
THANK YOU!!
this did work
once again i saved :)

B4X:
    j.PostString(URL,sXML)
    J.GetRequest.SetContentType("text/xml; charset=utf-8")

now i get success
but how to i get the returning XML with the answer ?
there is a returning value i need to get from there - "ReturnCode"
 
Upvote 0
Top