Create a .NET MATLAB Production Server Client
To create a MATLAB® Production Server™ client:
Obtain the client runtime files located in
. You can also download the client runtime files from MATLAB Production Server Client Libraries.$MPS_INSTALL
/client/dotnetIn consultation with the MATLAB programmer, agree on the MATLAB function signatures that comprise the services in the application.
Configure your system with the appropriate software for working with .NET.
Based on your requirements, decide if the client uses a static proxy or a dynamic proxy, or the MATLAB Production Server RESTful API for MATLAB Function Execution.
A static proxy uses an object implementing an interface that mirrors the deployed MATLAB functions. You provide the interface for the static proxy.
For more information, see Static Proxy Interface Guidelines.
A dynamic proxy creates server requests based on the MATLAB function name provided to the
invoke()
method. You provide the function name, the number of output arguments, and all of the input arguments required to evaluate the functions.For more information, see Invoke MATLAB Functions Dynamically.
The .NET client RESTful API uses protobuf for data serialization. For an example, see Asynchronous RESTful Requests Using Protocol Buffers in .NET Client.
If your client uses a proxy, write .NET code to instantiate a proxy to a MATLAB Production Server instance and call the MATLAB functions.
Create a dynamic proxy for communicating with the service hosted by MATLAB Production Server.
Declare and throw exceptions as required.
Free system resources using the
close
method ofMWClient
, after making needed calls to your application.
If your client uses the RESTful API, to use protobuf when making a request to the server, set the HTTP
Content-Type
request header toapplication/x-google-protobuf
in the client code. The .NET client library provides helper classes to internally create protobuf messages based on a proto format and returns the corresponding byte array. Use this byte array in the HTTP request body. The .NET client library provides methods and classes to deserialize the protobuf responses.