I have a set of C# samples for a REST based web services project. I am looking at converting some of these samples from C# to ABL as a proof of concept. Are there resources available that document any of the differences between the languages? A quick set of searches is not encouraging.
Thanks for any pointers or advice.
Bob Brennan
IMS, Inc.
This is an extremely minimal example but the Progress Github has some code that does a C# equivalent of an ABL DB query.
You can find it here: github.com/.../BasicQuery
There're more examples (such as a complex join on tables, ORM's vs temptables) but they're more geared towards Java and Python. Primarily because I know more Java and Python than C#.
Hope this helps!
Hey Bob,
Are you looking for ABL to make a REST call or for ABL on the server to handle the REST call? I have 11.4 client code that will make a REST call. We have been using this in production for 18 months or so.
Thanks everyone. We are looking to integrate an application written in ABL to a back end that offers REST based web services. The samples we have calling these web services are based on C#. Their model includes all of the service calls we need as methods, so we are shielded from needing to really do much in ABL. My issue is that there are a number of things that I see in the C# code that don't seem to translate and in some cases are not supported by ABL. An example is the use of Generics.
The back end guys have published .NET helper classes that really seem to get us about 80% of what we need in terms of getting data in useful formats. Not being fluent in C# or .NET for that matter really make this a stuttered approach. Find some new C# construct, learn some about it, look for an equivalent in ABL and repeat. Does not help that I am also new to OOABL.
Hey Bob,
We have our ABL client making REST calls to a 3rd party service. We also have our ABL client making REST calls to our ABL backend. Both of these implementations are sending/receiving XML. We did not have to play around with "Generics". If you want to email me I can send you a sample class that we are using to make the REST call.
Roger
I am trying to translate the following example from C# into ABL 11.6.1
I am struggling trying to translate
List<Customer> items = clientHelper.GetItems<Customer>(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<Customer> 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<Customer> items = clientHelper.GetItems<Customer>(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));
}
}
}