New to Telerik Reporting? Download free 30-day trial

Post Method to Pass Parameter in WebServiceDataSource

Environment

Product Version 12.2.18.1129+
Product Progress® Telerik® Reporting

Description

The attached project demonstrates using a REST Web Service with Post Method for the WebServiceDataSource. The Service returns a Person with Name and Surname.

Solution

Configuration of the WebServiceDataSource in the report:

  1. There are two report parameters- NameParameter and SurnameParameter.

    The MultiValue property of the second one is set to True.

    The AvailableValues come from a CSV DataSource. Note that the single values include quotes so that the corresponding JSON values can be properly configured.

  2. Set the Value property of the parameters with the default values.

  3. Add the WebServiceDataSource and set the Method to Post.
  4. Because the values will be defined through the parameters, set the Body as follows:

    {
        "Name": "@name",
        "Surname": @surname
    }
    

    Configure Data Retrieval page of the Web Service DataSource wizard in the Standalone Designer with Body parameters Name and Surname

    You can see that the Surname is without quotation marks because it is an array of strings.

  5. In the Configure request parameters, add a parameter for the header and to set the Value and Design-Time Value of the report parameters.

    Configure Request Parameters page of the Web Service DataSource wizard in the Standalone Designer with all necessary parameters set

Notes

  • The Content-Type Header parameter that is necessary is case-sensitive.
  • The parameters passed through the Body of the POST request should be Inline parameters.
  • The demo application could be downloaded from our Reporting-Samples GitHub repository.
In this article