Skip to main content
Version: 8.1

Call a custom web service

Level: intermediate

You can call a custom web service in several ways:

  • from the browser.
  • from the front-end.

Call a custom web service from the browser

Call a custom web service that uses cookie-based authentication from the browser

To call a .NET Framework custom web service that uses cookie-based authentication from the browser:

  1. Retrieve the authentication cookies using the AuthService.svc system web service.

  2. Call a custom web service using the following request string:

    SomeCreatioApppURL/0/rest/SomeCustomWebServiceName/SomeCustomWebServiceEndpoint?SomeOptionalParameters

The procedure to call a .NET Core or .NET 6 custom web service that uses cookie-based authentication is identical. That said, the /0 prefix is not required.

Call a custom web service that uses anonymous authentication from the browser

To call a .NET Framework custom web service that uses anonymous authentication from the browser, use the request string below.

SomeCreatioAppURL/0/ServiceModel/SomeCustomWebServiceName.svc/SomeCustomWebServiceEndpoint?SomeOptionalParameters

The procedure to call a .NET Core or .NET 6 custom web service that uses anonymous authentication is identical. That said, the /0 prefix is not required.

Call a custom web service from the front-end

  1. Add the ServiceHelper module as a dependency to the module of the page from which to call the service. This module provides a convenient interface for executing server requests via the Terrasoft.AjaxProvider request provider implemented in the client core.

  2. Call a custom web service from the ServiceHelper module.

    You can call a custom web service in several ways:

    • Call the callService(serviceName, serviceMethodName, callback, serviceData, scope) method.

    • Call the callService(config)method, where config is a configuration object.

      The config configuration object has the following properties:

      • serviceName is the name of the custom web service.
      • methodName is the name of the custom web service method to call.
      • callback is the callback function that handles the web service response.
      • data is the object that contains the initialized incoming parameters for the web service method.
      • scope is the scope of the request execution.
Important

The ServiceHelper module supports only POST requests. As such, add the [WebInvoke] attribute that contains the Method = "POST" parameter to the custom web service methods.