Create REST-ful services with Matlab?

I know it is possible to use REST complete web services from Matlab with a method webread

, but I want to show some matlab functions that I wrote as full REST web services.

Is it possible to do this from Matlab itself?

I guess this should be the way there is a method webread

to use REST-full services, but if it is not possible to do it natively from matlabcould, I write the services in java and then call the matlab code from java?

+3


source to share


1 answer


This is certainly possible. To share our experience, my team and I built the SaturnAPI using Octave (an open source Matlab clone). It provides hosting for your scripts as well as a RESTful API that you can use to access it. Here's how it works:

Figure 1. Basic flow of HTTP traffic between your web app and SaturnAPI.

Your script is hosted on a SaturnAPI server and accepts SaturnParams

as input, which is provided by an incoming HTTP request from your web application. SaturnParams

can be a string, number, array, or cell array. An array of cells allows you to pass various types of data to the API.



Once inside the server, the script is working with SaturnParams

, and the output is sent as an HTTP response to the origin server (i.e. your web application). You can see that with this method, you can use any script you like.

Doing everything that was by no means a trivial matter as you need to configure your web server to accept and respond to HTTP requests. Next, you need to create an interface for users to upload and test your scripts, which involves managing the database on the server. Then you need to think about scalability and load balancing. If you have further questions, I would love to share more.

+3


source







All Articles