This is a migrated thread and some comments may be shown as answers.

400 Bad Request for /api/reports/clients/{client_id}/parameters

3 Answers 702 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Yegor
Top achievements
Rank 1
Yegor asked on 15 May 2014, 06:20 PM
Hello,

I am trying to use HTML5 Report Viewer with MVC extension helper.

I have an error "Unable to get report parameters: Missing report name". It is happening during POST request to /api/reports/clients/210953-ab00/parameters which gets 400 Bad Request. 

I guess because request data do not have report: parameterValues: {} report: null

I call HTML helper like that:

    @(Html.TelerikReporting().ReportViewer()
        .Id("reportViewer1").ReportResolver(new TypeReportSourceResolver())
        .ServiceUrl("/api/reports/")
        .TemplateUrl(Url.Content("~/ReportViewer/templates/telerikReportViewerTemplate.html"))
        .ReportSource(new InstanceReportSource(){ReportDocument = new SessionReport()})
        .ViewMode(ViewModes.INTERACTIVE)
        .ScaleMode(ScaleModes.SPECIFIC)
        .Scale(1.0)
        .PersistSession(false)
    )

I have my ReportController implemented like:

public class ReportsController : ReportsControllerBase
    {
        protected override IReportResolver CreateReportResolver()
        {
            var reportsPath = HttpContext.Current.Server.MapPath("~/Reports");

            return new ReportFileResolver(reportsPath)
                .AddFallbackResolver(new ReportTypeResolver());
        }

        protected override ICache CreateCache()
        {
            return Telerik.Reporting.Services.Engine.CacheFactory.CreateFileCache();
        }
    }

And as I am using MVC5 with WepApi2 I have in my web.config following (I am not sure about last entry for Newtonsoft.Json):

      <dependentAssembly>
        <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-5.1.0.0" newVersion="5.1.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-5.1.0.0" newVersion="5.1.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-4.5.0.0" newVersion="4.5.0.0" />
      </dependentAssembly>

Can you help, please? Regards, Yegor.

3 Answers, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 16 May 2014, 05:46 PM
Hello Yegor,

The HTML5 Report Viewer is entirely HTML/CSS/JS based widget, which needs the ReportViewer-x.x.x.x.js(css) and telerikReportViewerTemplate.html template files to work. It also requires a running instance of the Telerik Reporting REST Service - the possible service's implementations are Web API and ServiceStack based. By default we provide 

To create a Web application project that uses the viewer and the Reporting REST Web API for example,  follow the steps listed in the following articles:
1.     How To: Use HTML5 Report Viewer extension in an ASP.NET MVC application
2.     How To: Add Telerik Reporting REST Web API to Web Application


Then if you need to make customizations over the reports, you can use a Custom Report Resolver. The string received by the resolver's Resolve method comes from the set viewer's reportSource.report option (use the HTML5 Report Viewer jQuery widget for the purpose).


Regards,
Stef
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Yegor
Top achievements
Rank 1
answered on 21 May 2014, 08:31 AM
Thank you!

My problem was that I have not used TypeReportSource with proper AssemblyQualifiedName, which is hard to enter manually.

Now to reduce hard-coding I use it like that:
@{
        var reportSource = new TypeReportSource() { TypeName = typeof(SessionReport).AssemblyQualifiedName };
        reportSource.Parameters.Add("SessionId", Model);
   }
@(Html.TelerikReporting().ReportViewer()
        .Id("reportViewer1")
        ...
        .ReportSource(reportSource)
        ...)
0
amaeze
Top achievements
Rank 1
answered on 28 Jun 2018, 05:04 PM

Please I need your help telerik team.

I have followed the instruction on How To: Add Telerik Reporting REST Web API to Web Application. It was successfully deployed.However, I encountered this error :

{
    "message": "An error has occurred.",
    "exceptionMessage": "Object reference not set to an instance of an object.",
    "exceptionType": "System.NullReferenceException",
    "stackTrace": "   at Telerik.Reporting.Services.WebApi.ReportsControllerBase.CreateInstance(String clientID, ClientReportSource reportSource) in c:\\temp\\reporting\\RBuild-1382\\Reporting_Build\\Source\\Code\\Telerik.Reporting.Services.WebApi\\ReportsControllerBase.cs:line 180\r\n   at lambda_method(Closure , Object , Object[] )\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass6_1.<GetExecutor>b__3(Object instance, Object[] methodParameters)\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__6.MoveNext()" 

 

whenever I try to create a report instance using a client ID 

Please help me

 

Kingsley

 

 

Tags
General Discussions
Asked by
Yegor
Top achievements
Rank 1
Answers by
Stef
Telerik team
Yegor
Top achievements
Rank 1
amaeze
Top achievements
Rank 1
Share this question
or