F Falcon Member Licensed User Sep 20, 2020 #1 Hi Experts, Please could someone give me the equivalent B4i code for the following B4a code: Code: Copy Response.GetAsynchronously("Response",File.OpenOutput(File.DirInternalCache,"Response.xml",False),True,TaskId) What this did was write an XML file called 'Response.xml' from an HTTP Response. Also what is the equivalent in B4i for: Code: Copy Response.Release Thank you very much for your time, Regards, Jacques.
Hi Experts, Please could someone give me the equivalent B4i code for the following B4a code: Code: Copy Response.GetAsynchronously("Response",File.OpenOutput(File.DirInternalCache,"Response.xml",False),True,TaskId) What this did was write an XML file called 'Response.xml' from an HTTP Response. Also what is the equivalent in B4i for: Code: Copy Response.Release Thank you very much for your time, Regards, Jacques.
Semen Matusovskiy Well-Known Member Licensed User Sep 20, 2020 #2 HttpResponse does not support GetAsynchronously and Release methods - see https://www.b4x.com/b4i/help/ihttp.html What's wrong in GetString / GetString2 ? Is your file too big ? Upvote 0
HttpResponse does not support GetAsynchronously and Release methods - see https://www.b4x.com/b4i/help/ihttp.html What's wrong in GetString / GetString2 ? Is your file too big ?
Erel B4X founder Staff member Licensed User Longtime User Sep 21, 2020 #3 Use OkHttpUtils2 / iHttpUtils2. Everything will be simple and cross platform. Upvote 0
F Falcon Member Licensed User Sep 22, 2020 #4 Hi Erel, I am already using iHttpUtils2, but I do not how to write the incoming JSON server response to XML. I can get the server response as a JSON string, I just need the code to convert the JSON to XML? I found this link: Json to Xml and Xml to Json The following code will convert Json to Xml and Xml to Json Required library's xmbuilder,json,javaobject Requires B4A 3.80 or B4j 2.20 The attached library source is https://github.com/douglascrockford/JSON-java the attached version excludes JavaException.java as it is already part of B4A Copy... www.b4x.com But it requires a reference to the JavaObject library which B4i does not have, please help. Regards, Jacques, Upvote 0
Hi Erel, I am already using iHttpUtils2, but I do not how to write the incoming JSON server response to XML. I can get the server response as a JSON string, I just need the code to convert the JSON to XML? I found this link: Json to Xml and Xml to Json The following code will convert Json to Xml and Xml to Json Required library's xmbuilder,json,javaobject Requires B4A 3.80 or B4j 2.20 The attached library source is https://github.com/douglascrockford/JSON-java the attached version excludes JavaException.java as it is already part of B4A Copy... www.b4x.com But it requires a reference to the JavaObject library which B4i does not have, please help. Regards, Jacques,
Semen Matusovskiy Well-Known Member Licensed User Sep 22, 2020 #5 Include iJSON and Xml2Map libraries. Convert JSON string (received from webserver) to Map Code: Copy Dim JSONParser1 As JSONParser JSONParser1.Initialize (stringJSON) Dim Map1 As Map = JSONParser1.NextObject Convert Map to XML Code: Copy Dim Map2Xml1 As Map2Xml Map2Xml1.Initialize () Dim stringXML = Map2Xml1.MapToXml (Map1) Write string to a file (File.WriteString). Upvote 0
Include iJSON and Xml2Map libraries. Convert JSON string (received from webserver) to Map Code: Copy Dim JSONParser1 As JSONParser JSONParser1.Initialize (stringJSON) Dim Map1 As Map = JSONParser1.NextObject Convert Map to XML Code: Copy Dim Map2Xml1 As Map2Xml Map2Xml1.Initialize () Dim stringXML = Map2Xml1.MapToXml (Map1) Write string to a file (File.WriteString).
Erel B4X founder Staff member Licensed User Longtime User Sep 22, 2020 #6 There is no relation between the (wrong) code posted in the first post and the actual question. Upvote 0