[progress Communities] [progress Openedge Abl] Forum Post: Accessing Rest Services Using Abl

  • Thread starter Thread starter mdanwarh
  • Start date Start date
Status
Not open for further replies.
M

mdanwarh

Guest
Hi, I am trying to access REST service (developed using OpenEdge 11.6 ) through Progress 4GL client. Below is the code I have used /*------------------------------------------------------------------------ File : getProperties.p Purpose : Syntax : Description : Author(s) : Created : Wed Mar 30 13:25:00 IST 2016 Notes : ----------------------------------------------------------------------*/ /* *************************** Definitions ************************** */ BLOCK-LEVEL ON ERROR UNDO, THROW. /* ******************** Preprocessor Definitions ******************** */ /* *************************** Main Block *************************** */ USING OpenEdge.Net.HTTP.*. USING OpenEdge.Net.URI. USING Progress.Json.ObjectModel.JsonObject. DEFINE VARIABLE oClient AS IHTTPClient NO-UNDO. DEFINE VARIABLE oURI AS URI NO-UNDO. DEFINE VARIABLE oCredentials AS Credentials NO-UNDO. DEFINE VARIABLE oRequest AS IHttpRequest NO-UNDO. DEFINE VARIABLE oResponse AS IHttpResponse NO-UNDO. DEFINE VARIABLE oCookies AS Cookie NO-UNDO. oClient = ClientBuilder:Build():KeepCookies():Client. /*CookiesJarBuilder:Build():CookieJar*/ oURI = NEW URI('http', 'ctsc00520904801.cts.com', 8810). oURI:Path = '/myOEABLWebApp/rest/myOEABLWebAppService/postCustomer/'. oCredentials = NEW Credentials('Tomcat Manager Application', 'tomcat', 'tomcat'). oRequest = RequestBuilder:Build('GET', oURI) :usingBasicAuthentication(oCredentials) :acceptJson() :Request. oResponse = ResponseBuilder:Build():Response. /*oClient:execute(oRequest, oResponse).*/ oResponse = ClientBuilder:Build():Client:Execute(oRequest). IF oResponse:StatusCode <> 200 THEN DISPLAY "Request Error" + String(oResponse:StatusCode). ELSE CAST(oResponse:entity, JsonObject):WriteFile('response.json', TRUE). But, when I execute the above code, I am getting below error. Can anyone let me know what could be the possible problem with the code?

Continue reading...
 
Status
Not open for further replies.
Back
Top