Integratec API Platform
C#

To import the opApi namespace, first add a reference to the assembly, opApi.net.dll.

Open

// Import the wrapper
using opNetApi;
// Instantiate the object
opClientConnection api = new opClientConnection();
// Open a connection
api.open("127.0.0.1", 60000)
// Alternatively, you can instantiate and open in the same call
opClientConnection api = new opClientConnection("127.0.0.1", 60000);

SendRequest

// Set input params
string serviceId = 'getBrokerIdentity';
string requestJson = '{}';
// Generate a request
string guid;
guid = api.sendRequest(serviceId, requestJson);

ReceiveReply

// Get the reply for the specified request ID with a timeout of 100ms
string replyJson;
replyJson = api.receiveReply(guid, 100);

DeleteRequest

// Clean up record of the specified request
api.deleteRequest(guid);

SendRecvDelete

// Create a request, get the reply, and clean up the request
replyJson = api.sendRecvDelete(serviceId, requestJson, 100);

Close

// Close the client connection
api.close();

Status Callback

using opNetApi;
namespace opConsole
{
class Program
{
static void Main(string[] args)
{
opClientConnection op = new opClientConnection("127.0.0.1", 60000);
// Set the local method to the callback event
op.statusEvent += op_statusEvent;
}
// Implement an example callback to print the id and status given by status
static void op_statusEvent(object sender, opClientConnection.statusEventArgs e)
{
Console.WriteLine("The status of id {0} is {1}.", e.id, e.status);
}
}
}