PPService.sendRequest

Syntax

sendRequest (body: String, callbackDelegate: PP.Delegate, errorCallbackDelegate: PP.Delegate, contentType: String, urlParams: String, language: String)

Parameters

body. Body of Web service request.

callbackDelegate. Callback procedure.

errorCallbackDelegate. Callback procedure on error.

contentType. Use protocol:

urlParams. Parameters or request URL.

language. Language settings. It can be returned by means of the PP.getCurrentCulture.CultureName method.

Description

The sendRequest method sends a request to Web service.

Comments

Body is a mandatory parameter. The request must be sent as a string. Use the JSON.stringify method to convert JSON to a string.

Example

To execute the example the HTML page must contain the ReportBox component named reportBox (see Example of Placing the ReportBox Component). In the JSON object in constructor parameters of the service prxMbService add the PPService.PPServiceUrl property, where enter the URL, by which a request is sent (the same value of the PPServiceUrl property that is set in parameters of the Metabase constructor). Send a request with the SetTabSheetData operation (setting report table data):

var body = {
   SetTabSheetData: {
      tTabSheet: prxReport.getTabId(), //table sheet moniker
      tArg: {
         refresh: {
            all: False,
            saveData: True
         },
         setPattern: {
            data: True
         },
         TabSheetData: {
            Cells: {
               Cell: reportBox.getDataView().getGridView().getTabSheet().getChangedCells() //cells with changed data
            }
         },
         getArg: {
            pattern: {
               data: True
            }
         }
      }
   }
};
prxBody = JSON.stringify(body); //Transform JSON to string
prxMbService.clearRequests(); //clear a list of requests from the queue and remove the current request
prxMbService.sendRequest(prxBody); //send request
//add a callback procedure for the request
prxMbService.addCallbackToLastRqt(new PP.Delegate(function (sender, args) {
         console.log(args.ResponseText)
      }));

After executing the example a request with the SetTabSheetData operation is sent to the web service. The browser console displays service response and the value True indicating that a callback procedure is set for the request.

See also:

PPService