Httpget And Json

Hi everybody,

OE11.6

i'm completely new to OpenEdge.Net.HTTP and JSon, so I would appreciate any help.

when I enter the following command in the address-line of a browser, i see the JSon-data on the screen.

http://datapad.it-park.at/projekte/...?u=connect/immoware&p=29immoware29!&anr=12345

I started with the following small test-program:

httpUrl = "http://datapad.it-park.at/projekte/...?u=connect/immoware&p=29immoware29!&anr=12345".
oRequest = RequestBuilder:Get(httpUrl):Request.
oResponse = ClientBuilder:Build():Client:Execute(oRequest).
oEntity = oResponse:Entity.
IF TYPE-OF(oEntity, JsonObject)
THEN CAST(oEntity, JsonObject):WriteFile("d:\v10\pcs\_entity.json", true).


Result: the program runs without errors, the JSon-File is created, but it contains only "{}".

I know that i'm doing something wrong, but i have absolutely no idea where to start

TIA
Wolf
 

Cecil

19+ years progress programming and still learning.
I tried the below code and it worked for me.

Code:
USING OpenEdge.Net.HTTP.IHttpRequest.
USING OpenEdge.Net.HTTP.IHttpResponse.
USING OpenEdge.Net.HTTP.RequestBuilder.
USING OpenEdge.Net.HTTP.ClientBuilder.
USING Progress.Lang.Object.
USING Progress.Json.ObjectModel.JsonArray.
USING Progress.Json.ObjectModel.JsonObject.

DEFINE VARIABLE oRequest    AS IhttpRequest     NO-UNDO.
DEFINE VARIABLE oResponse   AS IhttpResponse    NO-UNDO.
DEFINE VARIABLE httpUrl     AS CHARACTER        NO-UNDO.
DEF VAR oEntity            AS Object          NO-UNDO.

httpUrl = "http://datapad.it-park.at/projekte/datapad/immoware/datapad2ext.nsf/xp_httpGET.xsp?u=connect/immoware&p=29immoware29!&anr=12345".
oRequest = RequestBuilder:Get(httpUrl):Request.
oResponse = ClientBuilder:Build():Client:Execute(oRequest).

oEntity = oResponse:Entity.

IF TYPE-OF(oEntity, JsonObject)
THEN CAST(oEntity, JsonObject):WriteFile("./entity.json", true).

and got the following output:

Code:
{
  "wf_id": "12345",
  "wf_nr": "13245",
  "wf_bez": "Immoware 12345",
  "wf_titel": "Tablet-Übermittlung WF: 12345",
  "wf_betreff": "Datapad V1",
  "wf_start": "2017-06-30",
  "wf_frist": "2017-07-01",
  "txtUsername": "test\/immoware",
  "txtFormID": "4",
  "obj_eig_strasse": "Kärntnerstrasse 12",
  "obj_eig_name": "Immoware GmbH",
  "obj_eig_adresse": "1010 Wien",
  "obj_kan_nr": 1,
  "obj_kli_nr": 12,
  "obj_ap_telefon": null,
  "obj_ap_tel": null,
  "obj_ap_email": null,
  "Beginndatum": "2017-07-01",
  "Ersteller": "Wolfgang Schölmberger"
}
 
funny !
That's the same code I use. Nevertheless: i copied your code, ran it and my result is still the same: "{}", that's all I get.

Any ideas what could be the problem ?
I'm on OE11.6 and Win 8
 

RealHeavyDude

Well-Known Member
Don't get me wrong - but that's why I never use the plain vanilla release and always wait at least for the first service pack.
 
Top