Hi everyone: I created a REST Web Service using C# with Visual Studio, and i want to transfer this server in the Smart Connector. In the Web Service I created the methods GET, PUT, POST, DELETE and i used the class "System.Web.Http.APIController" under the main class. In visual studio the service (IIS) has port 59951, while the smart connector has another port (8082)
I compiled the code and moved the file.dll in the Smart Coonnector where i configured the Processor, but i have the following question:
1) How i can call this method in Smart Connector with a REST client (for example Postman or Advanced REST Client)
2) Do I have to write on visual studio the port of smart connector?
3) How the smartconnector gets the topics from the REST client?
Thank you so much
SmartConnector doesn't use IIS at all. Rather, SmartConnector utilizes the Owin stack to self host HTTP endpoints. The port you are referring to (8082 by default) is actually the "Portal" port. No request made to this could be routed to your controllers in any way.
SmartConnector also uses Owin to serve up "RESTful EWS Gateway" endpoints. Which brings me to my recommendation. The "RESTful EWS Gateway" is actually a specific implementation of SmartConnector's "REST Extension Framework". And as such, SmartConnector developers are free to extend this framework to create your own custom endpoints. By using this approach, rather then direct "roll your own" approach, you will get the following benefits for free:
Unfortunately, we haven't yet fully documented the process into it's own Developer's Guide or as an Appendix to that.
I might be able to stub out a shell "Extension" and post it into the public GitHub samples project. What is your time frame for implementation? Is this just a proof of concept or an actual job?
Thank you for help,
After your suggestion i've created a Server Rest OWIN and l compiled the code and moved the file.dll in the Smart Connector and it work.
It is an actual job, that we want to transfer data between an external database and the ES. We have performed the work with OWIN and we have managed to activate the server from the smartconnector. Moreover, do you have any documentation on this part of OWIN?
I would like to ask you 2 more questions:
Thank you so much
I'm seeing two separate issues here...
Since you are speaking of "Processor" and "WebApp.Start" you are still not using SmartConnector's "REST Extension Framework" as I referred to in my prior post on this thread. Instead, you are taking over all apsects of the endpoint and standing it up from within a Processor. While this is certainly a valid approach, it has many downsides as you now see. Besides not having configuration, provisioning, auth, licensing, throttling, etc done for you by the framework (or perhaps you even duplicated effort in one or more of these areas), you also need to always have a Processor running for the sole purpose of keeping the endpoint alive.
I do realize that authoring your own REST Extension isn't well documented at this point. This is why I inquired as to your timeframe and whether this was for a real job or not. I was trying to gauge the urgency for posting an example to GitHub.
For now, you can continue the approach you are on but please make sure your Proccessor code looks like this:
protected override IEnumerable<Prompt> Execute_Subclass()
using (WebApp.Start(url, configurationAction)) // url and configurationAction are as you have them now
} while (!IsCancellationRequested); // This will allow the Processor to respond to STOP requests
return new List<Prompt>();
Also, make sure that your Processor implements ILongRunningProcess. Failure to do that, will result in the WorkerManager attempting to "kill" the Proccessor.
I read your question to mean you have data in some SQL DB/Tables that you want to serve as EWS data back to SBO. There are two approaches you can use for this.
Thanks for your help.
It is a real job application and we have to do this work for three different installations required for 3 european projects we are currently participating:
In each project we are deploying a server for real time and historical exchange of data between the ES, through smartconnector (with our custom methods GET,PUT,POST,DELETE), and the applications of other partners using REST API over JSON structure .
The application in one of these projects is pretty urgent, so we think we will continue with the existing approach and when you can provide us documentation or an example to GitHub we will create the Server with "REST Extension Framework".
Do you think that moving from my Server (with OWIN) to Server with REST Extension Framework it takes a lot of time?
The amount of time required to switch over to the REST Extension Framework should be minimal. Almost all of your controller code will be directly portable. I will post to this forum when the samples and documentation are available.
I would like to ask you if the samples and documentation to the "REST Extension Framework" are availabe.
Thank you so much
I believe Michele was looking for information/samples on how to consume the REST Extension framework to author a custom REST API in SmartConnector (not specifically the existing Providers).
That won't be available until after the SmartConnector 2.3 release (Q4 2017).
The job for the project is very urgent, so we will continue with the existing approach and when you can provide us documentation or an example to GitHub we will create the Server with "REST Extension Framework".
To make it easier the "transition" from Server (OWIN) to Server with REST Extension Framework, you could give me an example or advice on implementing the "safe comunication" (OAuth Bearer Token Authentication).
Thank you so much
We are about to embark on a new project where we need to set up a really simple REST Api Endpoint, probably just one route to send an email. We were thinking of using the Custom Endpoint feature. I've been having a look at the code classes but can't see how to get started. Would you have a simple class example or code stub to show how to create a custom endpoint? I presume we do not need an EWS Server as part of the configuration?