The company I work for provides several legancy C# libraries APIs. The customer is asking us to provide a Web Service API facade on top of the legacy server side C# library API. Basically, in a standard HTML page, call the web service with JavaScript.
The C# API has the following properties:
There is a logical begin and end point for using the C# API.
The order of the calls into the C# API is significant.
The state of the C# API is stored in memory between the logical start and finish points. The state is not persisted in a file or database, etc.
Just for demonstration and discussion purposes, using the API in C# looks something like this:
Engine myEngine = new Engine();
myEngine.Lock();
myEngine.Items.Add(new Item(“Foo”));
myEngine.Calculate();
myEngine.Items.Add(new Item(“Bar”));
myEngine.MethodX(5,1);
myEngine.Calculate();
myEngine.GetXYZXResults();
myEngine.Get123Results();
myEngine.Unlock();
myEngine.Dispose();
How would you approach creating a web service on top of this server API?
Couple options i am debating:
Mimic the object graph in JavaScript. Client side code fills up the JavaScript object graph and a single big JSON ajax call is made to the server.
Or, create a web api with multiple URL end points....
DapperDanH
Member
2 Points
2 Posts
Web Service Facade for a Legacy C# API: best strategies?
Jan 07, 2013 08:07 PM|LINK
The company I work for provides several legancy C# libraries APIs. The customer is asking us to provide a Web Service API facade on top of the legacy server side C# library API. Basically, in a standard HTML page, call the web service with JavaScript.
The C# API has the following properties:
Just for demonstration and discussion purposes, using the API in C# looks something like this:
Engine myEngine = new Engine();
myEngine.Lock();
myEngine.Items.Add(new Item(“Foo”));
myEngine.Calculate();
myEngine.Items.Add(new Item(“Bar”));
myEngine.MethodX(5,1);
myEngine.Calculate();
myEngine.GetXYZXResults();
myEngine.Get123Results();
myEngine.Unlock();
myEngine.Dispose();
How would you approach creating a web service on top of this server API?
Couple options i am debating:
Thoughts? Opinions?
Thanks,
Dan