Docs Menu
Service
The service behaves like functions in the programming languages. A function is first defined and then called for its proper usage. The main advantage of using services is that it aids in better reusability of program code. On the Syncloop API development Platform, the service behaves like same. Here the service can be a API, SQL Service or a Java Service. These services once called can be reused in another API. The various input and output parameters associated with that service will also get imported while calling this service. These parameters can even be mapped with local parameters of the API. Multiple services can be called in a single API that provide a robust platform for continuous Service integration feature of Syncloop.
To call an already created Web or Java service in an existing API, right-click on the workspace and select Service option in the API DESIGNER context menu.
This will create a new INVOKE in the Workspace. Right-click on the invoke and ‘select the service” option.
Search the service in the Package Explorer and assign the service with the INVOKE. In the Service Step a API and a Java Service can be called.
Services also follow recursion i.e. (Service can call itself). The limitation of recursion is that the service can recursively call itself only up to one hundred times. Therefore, the execution of these recursive services needs to be kept in a limit by using appropriate condition checks.
The Services are classified as Asynchronous or Synchronous
Asynchronous Services
In this type of Service call, other Web/Java/SQL services continue to operate while waiting for other services call to return. In case of Asynchronous services, the code execution does not block (or wait) for the API call to return from the server. Execution continues on in your service, and when the call returns from the server, a callback service is executed. On Syncloop platform we create an object that stores the task info and the output. Whenever output is needed a service name Wait is called in which task id is given as input. It will wait for the task to complete and once it is completed it will populate the object with the new output.
Synchronous Services
In this type of Service call, other Web/Java/SQL services wait until service returns and during this period all other services are stopped. The code execution will block (or wait) for the API call to return before continuing. The service wait is achieved using wait service that enables the application to wait for the service to get completely executed. This means that until a response is returned by the API, your application will not execute any further, which could be perceived by the user as latency or performance lag in your app. Making an API call synchronously can be beneficial, however, if there if code in your app that will only execute properly once the API response is received.