Page 1 of 1

Calling APIController

Posted: Fri Oct 21, 2022 12:34 am
by ChrisChen
Hi,

I am trying to using Angular report with ApiController OWIN server.

below is my ApiController code, the only difference between sample code and mine is the controller inherits from ApiController, not Controller

Code: Select all


    public class BalanceSheetViewerController : ApiController
    {
        private readonly IBalanceSheetLogic logic;
        private readonly ICompInfoLogic compInfoLogic;

        public BalanceSheetViewerController(
            IBalanceSheetLogic logic,
            ICompInfoLogic compInfoLogic
        )
        {
            this.logic = logic;
            this.compInfoLogic = compInfoLogic;
        }

        [System.Web.Http.HttpPost]
        [AllowCrossSiteJson]
        public ActionResult InitViewer()
        {
            var requestParams = StiAngularViewer.GetRequestParams();
            var options = new StiAngularViewerOptions();
            options.Actions.GetReport = "GetReport";
            options.Actions.ViewerEvent = "ViewerEvent";
            options.Appearance.ScrollbarsMode = true;

            return StiAngularViewer.ViewerDataResult(requestParams, options);
        }
        ......
        

everything looks good until running it. when the client angular runs receive the error from
return StiAngularViewer.ViewerDataResult(requestParams, options)
the error is
Object reference not set to an instance of an object.
and below is the call stacks

Code: Select all

   at Stimulsoft.Report.Web.StiCacheHelper.GetObject(String guid)
   at Stimulsoft.Report.Web.StiCacheHelper.GetResource(String guid)
   at Stimulsoft.Report.Web.StiViewerResourcesHelper.GetStyles(StiRequestParams requestParams)
   at Stimulsoft.Report.Angular.StiAngularViewer.ViewerDataResult(StiRequestParams requestParams, StiAngularViewerOptions options)
   at Beyond.API.Controllers.BalanceSheetViewerController.InitViewer() in BalanceSheetViewerController.cs:line 42
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass6_2.<GetExecutor>b__2(Object instance, Object[] methodParameters)
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)
Could you help with this?
Thanks!

Re: Calling APIController

Posted: Fri Oct 21, 2022 8:31 am
by Lech Kulikowski
Hello,

We need some additional time to investigate the issue, we will let you know about the result.

Thank you.

Re: Calling APIController

Posted: Wed Oct 26, 2022 7:31 am
by Vadim
Hello.

Please try options.Server.CacheMode = StiServerCacheMode.StringCache;

Re: Calling APIController

Posted: Mon Nov 21, 2022 5:06 pm
by ChrisChen
Vadim wrote: Wed Oct 26, 2022 7:31 am Hello.

Please try options.Server.CacheMode = StiServerCacheMode.StringCache;
Hi, it's still got the null reference error.

Thanks

Re: Calling APIController

Posted: Wed Nov 23, 2022 8:10 am
by Lech Kulikowski
Hello,

Please clarify which version are you use?

Thank you.