I'm pretty sure this can't be done directly in the ABL but wanted to run it past the experts to confirm. I'd be very happy to be wrong.
ServicePointManager.ServerCertificateValidationCallback = MyCertHandler;
static bool MyCertHandler(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors error)
{
return true;
}
Unfortunately you are correct. The ABL does not support implementing .NET delegate types, which is what the ServerCertificateValidationCallback property is.
msdn.microsoft.com/.../system.net.security.remotecertificatevalidationcallback(v=vs.110).aspx
But you just have to create a .NET class for the delegate. The rest of the code might return ABL. Typically, when I need to deal with synchronously called delegates, I write a C# class that implements the delegate and raises an event. That way I can implement an event handler in the ABL and keep most of the actual logic in ABL.
sadly you’re right, callbacks (delegates) are not supported so you’ll need to build some kind of wrapper in .net for that :(
Mike, what to do when I want to perform a HTTPS call in an AppServer agent? Documentation states: "OpenEdge does not support the handling of .NET object events in non-GUI ABL sessions, such as a character-mode client or AppServer agent.".
Roger van Kanten
Well Roger, that depends on the OpenEdge version you're running (still 10.2B?). The restriction on running the non-UI .NET classes have been lifted for a while (somewhere in 11.x, don't know which one exactly).
Ah, they retro fitted it to 10.2B? Much to my delight I don't have to work with that version anymore :-)
We're using 11.5.0 but the quote about the .NET object events is from the 11.6 documentation, page 62 of "GUI for .NET Programming".
To my experience that refers to UI events. You can certainly subscribe to a class event and the event handler will execute when the event is raised. .NET Events are just synchronous (potentially multiple) call backs.
Thanks Mike.
Yes, that quote in the 11.6 doc is no longer correct. I will get log a bug to get it removed.