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,

Comments

  • Jeff,

    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 will be using Visual Studio and C#. And yes it will be a .net web application.

    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
  • Hi Jeff. Just so I am clear, does the existing web application already use OpenInsight and OECGI?
  • Yes, I have been asked to take it out of Flex and into a up to date program. I picked C#. But I was hoping to not have to recreate a lot of the core of the application.
  • Then it seems to me that you really just need to know how to make HTTP requests from C#, correct?
  • Yes, that is correct. I am also open to a better solution if you have one.
  • I am not sure if I have a better solution for you. I don't think I have enough information regarding this project and the final goals/requirements to propose any alternatives. However, if you would like to call me to discuss I'd be happy to review this project with you in greater detail and hopefully leave you with some new ideas to consider. I'm available today after 1pm PST.

    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.
  • Great,
    I will call you. I do need to know how to make http requests from C#
  • Everything you need to make http calls is in the HttpClient class.

    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");
  • Thanks for all your help. It all lead to getting pointed to the following link that was everything we needed to use C# and ASP (Dot Net) working with calling the OECGI and open insight. We got it working and are now working on building out part of the application. You can file it away if asked again.

    https://docs.microsoft.com/en-us/dotnet/framework/network-programming/how-to-request-data-using-the-webrequest-class

    Thanks Again for your help.
Sign In or Register to comment.