Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.
OECGI and ASP.NET
I am converting an existing web application into C#.
Does anyone have any documentation with example code on how to properly format a call to OECGIx using C# and how to get a response back from OI? (Not the OI code. I have most of that under control)
Anything would be a great help.
Thanks,
Does anyone have any documentation with example code on how to properly format a call to OECGIx using C# and how to get a response back from OI? (Not the OI code. I have most of that under control)
Anything would be a great help.
Thanks,
Comments
It sounds like you are moving to a .NET web application and want to communicate with OI. You could communicate with OECGI using REST such as the SRP HTTP Framework. This would mean your .NET could make REST requests to OECGI and OI which is standard and clean. However, since you are working in .NET I think there are two better options for you to consider.
1) Communicate with OEngineServer directly. OECGI is simply a conduit for taking a web request and passing it to the OEngienServer service where the OI code executes. You could have your .NET application communicate with the OEngineServer service directly using the JD3 protocol. There is some documentation here in the OEngineServer Specifications or you can look at the source code of the OECGI3P.php to see it implemented.
2) Communicate directly with OI using the Revelation .NET Assembly. Your .NET code can reference the assembly and communicate with OI programmatically. OI code still executes in the OEngineServer service but the Revelation .NET Assembly takes care of the communication layer and exposes some methods for running routines that are easy for .NET to understand. Look at the NetOIExampleForm in the OpenInsight directory or the NetOI.chm file for more information.
If you can tell me more about the architecture of the web application it would help in making a recommendation. for instance, if your web server and OI server will be in different data centers the REST API through OIECGI might be a good choice but if the web server and OI server will be in the same data center then communicating with OI using the two methods described might have advantages.
Employing the SRP HTTP Framework to enable REST API access to OI might also make it easier for front-end clients to query OI directly instead of traversing through an extra layer (your .NET code) to interact with OI. Again, this depends on your architecture.
I am not familiar with the REST requests. I will investigate. Is it part of the SRP HTTP Frameworks? I am not against the HTTP Frameworks. But I was trying to be more generic in my approach. I will look at the cost of the HTTP Frameworks.
Thanks
Having said that, I don't want to derail your original post and question. I personally don't know how to make HTTP requests from within C# but I sure someone on my staff (perhaps even Jared) might be able to answer that question.
I will call you. I do need to know how to make http requests from C#
Like all the newest C# features, everything is Async. So, if you aren't familiar with the async/await syntax, I highly recommend you get good with it. Everything in C# is using it now.
Once you set up an instance of HttpClient, doing an http GET is just one line of code:
var responseString = await client.GetStringAsync("http://www.example.com/resource/1");
https://docs.microsoft.com/en-us/dotnet/framework/network-programming/how-to-request-data-using-the-webrequest-class
Thanks Again for your help.