Web Service

Sym3 Operator Server / Integrator can host a web service that can be called by external application (e.g browser) and a script function that receives a callback when service is called

When simulation/server starts, Sym3 will host a web service for the specified port

Warning: you will need to start Sym3 Integrator or Sym3 Operator Server as Administrator.

Creating a service

In Project Explorer, right click on Services > New Web Service.

In the Property Editor, Set Port and Callback. The port must be unique for each Service.

Properties

  • Name: Freeform name of the service
  • Port: The port on which service listen to
  • Callback: Script function which will be excuted when service is called

Note: click on the small button on the right side of the callback name to copy the callback function into clipboard.

Callback function

  • sender: Type String. Name of caller
  • parameter: Type String. Containing all params and value sent through http request e.g. name1:value1,name2:value2
// sender: name of caller
// parameter: string value containing all params and value sent through http request e.g. name1:value1,name2:value2
function Test(sender,parameter) {
    
}

Example

  • Start Sym3 Integrator as administrator and create a new project.
  • Create a ‘Web Service’

  • Add a simulation script function:
// sender: name of caller
// parameter: string value containing all params and value sent through http request e.g. name1:value1,name2:value2
function OnMessageWebService(sender, parameters) {
 
    LogDebug("Hello: " + parameters)
}

Troubleshoot

You may have to authorize the port in firewall to access the web service from another machine.

  • Open Firewall and add a new inbound rule:

  • Select ‘Port’:

  • Select ‘TCP’ and allow port 8500 (or the port number you are using):

  • Allow the connection and give it a name