[progress Communities] [progress Openedge Abl] Forum Post: Re: C# To Openedge

  • Thread starter Thread starter bbrennan
  • Start date Start date
Status
Not open for further replies.
B

bbrennan

Guest
I am trying to translate the following example from C# into ABL 11.6.1 I am struggling trying to translate List items = clientHelper.GetItems (request); The following is a full sample of a C# demo. The web service can deliver the results as Raw JSON, a JSON Object or a mapped list. I can successfully call the web service. In the case of returning a list of customer, I am struggling with how to manage/deal with the returned values. I am thinking I want a mapped list instead of a JSON Object but that might not be possible. Thanks for any feedback. Like I have said before C#, .NET things and OOABL are all new to me. Bob ------------------------------- using System; using System.Collections.Generic; using IMS.Entities.Lib.API; using IMS.Entities.Lib.CRM; using IMS.WebAPIClient; using IMS.WebAPIClient.RequestBuilder; namespace IMS.WebAPI.Examples.Customers.Data { public class CustomerRepository { private const string UrlGetCustomers = "/CRM/CustomerCentral/Customers/"; // GET private const string UrlUpdateCustomer = "/CRM/CustomerCentral/UpdateCustomer/"; // POST private const string UrlDeleteCustomer = "/CRM/CustomerCentral/DeleteCustomer/"; // POST public static List GetCustomers() { IMSServiceClient clientHelper = SessionManager.Instance().GetServiceClient(); ServiceRequest request = clientHelper.NewRequest(UrlGetCustomers); request.SetHttpMethod("GET"); // Get json object // JObject json = clientHelper.GetJson(request); // Get raw json response // string rawResponse = clientHelper.GetRawResponse(request); // Get mapped Customer list List items = clientHelper.GetItems (request); return items; } public static void UpdateCustomer(Customer customer) { IMSServiceClient clientHelper = SessionManager.Instance().GetServiceClient(); ServiceRequest request = clientHelper.NewRequest(UrlUpdateCustomer); request.SetHttpMethod("POST"); request.SetDataObject(customer); IqWebResponse response = clientHelper.GetSuccessResult(request); if (!response.DidSucceed) throw new ApplicationException(string.Format("Error updating customer - {0}", response.Message)); } } }

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