New to Telerik Reporting? Download free 30-day trial

WebServiceDataSource Wizard Displays object Object

Environment

Product Progress® Telerik® Reporting
Project Type ASP.NET Web Application
Target Framework .NET Framework

Description

When I attempt to preview the data of the WebServiceDataSource component in the last page of the wizard, instead of seeing the response printed on the page, it displays [object Object]s.

Cause

In the .NET Framework implementation of the ReportDesignerControllerBase class, which must be used to create a controller for the Report Designer service in the project, the PreviewWebServiceData(DataSourceInfo) method returns a JSON response instead of a stringified JSON, thus the inner text of the element on the page cannot be bound correctly.

Suggested Workarounds

As a workaround, the PreviewWebServiceData(DataSourceInfo) method of the report designer controller can be overridden to return a plain text response instead of JSON:

public override IHttpActionResult PreviewWebServiceData(DataSourceInfo dataSourceInfo)
{
    var baseResult = (ResponseMessageResult)base.PreviewWebServiceData(dataSourceInfo);
    var jsonString = baseResult.Response.Content.ReadAsStringAsync().Result;

    return Ok(jsonString);
}

See Also

In this article