HI, i need
a problem when try to download a largeb64 files using a REST Webserver
the web server return a a simply b64string but if this string is grather than 2 MB i have error
Please i need an help
thanks
a problem when try to download a largeb64 files using a REST Webserver
the web server return a a simply b64string but if this string is grather than 2 MB i have error
B4X:
Sub Globals
Dim wsjob as HttpJob
Dim JsonString as String
end sub
Sub callWS
wsjob.Initialize("WS", Me)
wsjob.PostString("myWS_Url","mywsparameters")
wsjob.GetRequest.Timeout = 50000
end sub
Sub JobDone (Job As HttpJob)
If Job.Success Then
Dim lsjob As List
Dim mapJOB As Map
lsjob.Initialize
mapJOB.Initialize
lsjob.Clear
mapJOB.Clear
lsjob = xWSJ2List(JOB,True)
mapJOB = lsjob.Get(0)
Dim B64 As Base64
Dim by() As Byte
Dim l As Int = sf.Len(mapJOB.Get("DBAgente"))
by = B64.DecodeStoB(mapJOB.Get("DBAgente")) 'THIS LINE IS THE PROBLEM!!!
Dim out As OutputStream
Dim dir As String
dir = File.DirRootExternal
out = File.OpenOutput(dir,"myfile.zip",False)
out.WriteBytes(by,0,by.Length)
out.Close
else
end if
job.release
End sub
Sub wsJsonParser_EndElement (Uri As String, Name As String, Text As StringBuilder)
JsonString = Text
End Sub
Sub xWSJ2List(Job As HttpJob, isArray As Boolean) As List
Dim oIS As InputStream
Dim wsJsonParser As SaxParser
wsJsonParser.Initialize
oIS = Job.GetInputStream
wsJsonParser.Parse(oIS, "wsJsonParser")
oIS.Close
Dim JSon As JSONParser
If sf.Left(JsonString,1) <> "[" Then 'INCAPSULO LE STRINGHE JSON COME VETTORI
JsonString = "[" & JsonString & "]"
End If
JSon.Initialize(JsonString)
Dim list_by_Json As List ' carico tutto il JSON nella lista
list_by_Json = JSon.NextArray
Return list_by_Json
End Sub
Please i need an help
thanks