Main Content
Java Client Programming
Create client programs in Java®
The MATLAB® Production Server™ Java client API allows you to evaluate MATLAB functions deployed on remote servers using native Java data.
In an on-premises MATLAB
Production Server installation, the client APIs are located in
, where
$MPS_INSTALL
/client
is the MATLAB
Production Server installation location. The client APIs are also available for download at MATLAB Production Server Client Libraries. The Java client API is also hosted in a Maven™ repository at https://mvnrepository.com/artifact/com.mathworks.prodserver/mps_java_client.$MPS_INSTALL
Topics
Java Client Programming Basics
- MATLAB Production Server Java Client Basics
Learn how to call a MATLAB function deployed to MATLAB Production Server from a Java application.
Programming Using Static and Dynamic Proxy
- Create MATLAB Production Server Java Client Using MWHttpClient Class
Define an interface, instantiate a static proxy object, and then call the deployed function. - Configure Client-Server Connection
Extend theMWHttpClientDefaultConfig
class and override its methods to modify the default configuration. - Invoke MATLAB Functions Dynamically
Invoke MATLAB functions using a function name and argument list. - Bond Pricing Tool for Java Client
This example shows an application that calculates a bond price from a simple formula. - Java Client Coding Best Practices
When you write Java interfaces to invoke MATLAB code, remember these considerations:
Programming Using RESTful API and Protocol Buffers for Data Serialization
- Asynchronous RESTful Requests Using Protocol Buffers in the Java Client
Example that shows how to make asynchronous RESTful requests using protocol buffers in the Java client. - Synchronous RESTful Requests Using Protocol Buffers in the Java Client
Example that shows how to make synchronous RESTful requests using protocol buffers in the Java client. - Struct Support for RESTful Requests Using Protocol Buffers in the Java Client
Example that shows the support for structs as input for RESTful requests using protocol buffers in the Java client.
Inputs and Outputs
- Code Multiple Outputs for Java Client
MATLAB allows users to write functions that return multiple outputs. - Code Variable-Length Inputs and Outputs for Java Client
MATLAB supports functions with both variable number of input arguments (varargin
) and variable number of output arguments (varargout
).
Security
- Execute MATLAB Functions Using HTTPS
Configure the server and client environment to use SSL, then create a program proxy using the URL of the deployed application. - Customize Security Configuration
Configure HTTPS settings usingMWSSLConfig
.
Data Types and Data Conversion
- Marshal MATLAB Structures (Structs) in Java
Structures (or structs) are MATLAB arrays with elements accessed by textual field designators. - Evaluate Deployed Machine Learning Models Using Java Client
This example shows how to write a client application that sends an array of objects to a deployed machine learning model. - Data Conversion with Java and MATLAB Types
There are many data types that you can work with in MATLAB. - Conversion of Java Types to MATLAB Types
Learn how the server converts data between Java and MATLAB data types. - Supported MATLAB Data Types for Client and Server Marshaling
MATLAB Production Server supports marshaling of several MATLAB data types between client applications and server instances.