1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Httpget And Json

Discussion in 'Development' started by Wolfgang Schölmberger, Sep 28, 2017.

  1. Hi everybody,


    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.


    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

  3. Cecil

    Cecil 17+ years progress programming and still learning.

    I tried the below code and it worked for me.

    Code (progress):
    1. USING OpenEdge.Net.HTTP.IHttpRequest.
    2. USING OpenEdge.Net.HTTP.IHttpResponse.
    3. USING OpenEdge.Net.HTTP.RequestBuilder.
    4. USING OpenEdge.Net.HTTP.ClientBuilder.
    5. USING Progress.Lang.Object.
    6. USING Progress.Json.ObjectModel.JsonArray.
    7. USING Progress.Json.ObjectModel.JsonObject.
    9. DEFINE VARIABLE oRequest    AS IhttpRequest     NO-UNDO.
    10. DEFINE VARIABLE oResponse   AS IhttpResponse    NO-UNDO.
    11. DEFINE VARIABLE httpUrl     AS CHARACTER        NO-UNDO.
    12. DEF VAR oEntity            AS Object          NO-UNDO.
    14. httpUrl = "http://datapad.it-park.at/projekte/datapad/immoware/datapad2ext.nsf/xp_httpGET.xsp?u=connect/immoware&p=29immoware29!&anr=12345".
    15. oRequest = RequestBuilder:Get(httpUrl):Request.
    16. oResponse = ClientBuilder:Build():Client:Execute(oRequest).
    18. oEntity = oResponse:Entity.
    20. IF TYPE-OF(oEntity, JsonObject)
    21. THEN CAST(oEntity, JsonObject):WriteFile("./entity.json", true).
    and got the following output:

    Code (progress):
    1. {
    2.   "wf_id": "12345",
    3.   "wf_nr": "13245",
    4.   "wf_bez": "Immoware 12345",
    5.   "wf_titel": "Tablet-Übermittlung WF: 12345",
    6.   "wf_betreff": "Datapad V1",
    7.   "wf_start": "2017-06-30",
    8.   "wf_frist": "2017-07-01",
    9.   "txtUsername": "test\/immoware",
    10.   "txtFormID": "4",
    11.   "obj_eig_strasse": "Kärntnerstrasse 12",
    12.   "obj_eig_name": "Immoware GmbH",
    13.   "obj_eig_adresse": "1010 Wien",
    14.   "obj_kan_nr": 1,
    15.   "obj_kli_nr": 12,
    16.   "obj_ap_telefon": null,
    17.   "obj_ap_tel": null,
    18.   "obj_ap_email": null,
    19.   "Beginndatum": "2017-07-01",
    20.   "Ersteller": "Wolfgang Schölmberger"
    21. }
  4. 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
  5. Cringer

    Cringer ProgressTalk.com Moderator Staff Member

    Some sort of Firewall issue?
  6. Firewall is not active, only AVG is running. I already turned AVG off, did not solve the problem
  7. tried it on laptop, where Avira is running instead of AVG --> and everything works fine !
    Thanks to everybody who helped !
  8. for all who are interested: OE11.6 seems to have a bug.

    installed SP 3 (OE11.6.3) and now everything works fine, I get the JSon-Response as expected.
  9. RealHeavyDude

    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.
    LarryD likes this.

Share This Page