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

Existing ServiceStack based API

5 Answers 148 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Sean
Top achievements
Rank 1
Sean asked on 19 Jan 2015, 09:30 PM
I've got an existing RESTful API developed to support the rest of our products, I'm wondering if there is a way to use the reporting services with that. The API is written in c# and uses ServiceStack, satisfying many of the requirements for the reporting services.

Following the guide here seems to have been a good start: http://www.telerik.com/help/reporting/telerik-reporting-rest-servicestack-hosting-iis.html

The trouble I'm running into is that ReportsHostBase seems to derive from the ServiceStack class AppHostBase. Obviously our existing project already has an AppHostBase instance, so I can't use the Init member of ReportsHostBase. It appears as if Init creates a report resolver as well as some sort of cache provider.

So I guess my question is this... Has anybody ever added Telerik reporting services to an existing ServiceStack project? 

5 Answers, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 20 Jan 2015, 09:52 AM
Hello Sean,

Currently Service Stack v4 is not supported. If there is a demand for it and the resources required for adding the feature are reasonable, we will consider having support for ServiceStack v4 in future releases. Feel free to use our feedback portal and publicly vote for the feature - feedback portal: service stack or custom provider support.

About the current Reporting ServiceStack support. The Telerik Reporting REST service's represents the rendered reports as web accessible resources.

Its ServiceStack  implementation requires it to be the only ServiceStack based service in the project. If you need to incorporate other ServiceStack services, you can separate them in different projects and enable CORS to allow the communication between them and the project with the viewer.

The configuring the routes for the service, you can change the api keyword from the configuration of the service project. Check step 7 in the How To: Add Telerik Reporting REST ServiceStack to Web Application article - in the location element you can specify the key word for all routes.


Let us know if we can be of any further help for you.


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
Sean
Top achievements
Rank 1
answered on 20 Jan 2015, 02:58 PM
Hi Stef - 

Thanks for the reply on that. 

Running the reporting services on its own site won't be a big deal. In fact it may even be ideal for us to have a clear separation between reporting services and the rest of our API. 

A follow up question, then, would be about authentication. We use a Redis as the caching provider for ServiceStack in our existing API. We chose this specifically so we share user sessions between multiple servers for load balancing, redundancy, etc.

In our specific circumstance, we use the "Authenticate" attribute on top of all of our services, telling SS to pay attention to the ss-id in the header of the http request. 

See "The Authenticate attribute" at https://github.com/ServiceStack/ServiceStack/wiki/Authentication-and-authorization

So my question is this: Is it possible to specify decorate the Telerik services (I.e., the classes that derive from ServiceStack.ServiceInterface.Service) and/or request DTOs with the "Authenticate" attribute? If so, can I specify a cache provider and a custom user session (i.e., our redis server and our user session class)? 

Thanks much, 
-Sean 






0
Stef
Telerik team
answered on 23 Jan 2015, 02:06 PM
Hi Sean,

Thank you for your update.

If hosting the Reporting REST service fits your requirements, please consider switching to the WebAPI implementation - Telerik Reporting REST service. To change the default routes for the service, you can use the details from the How to change the registered by default Telerik Reporting REST Web API routes KB article.

Using Telerik Reporting REST WebAPI will allow you to override the service's methods and add the required attributes where needed. The WebAPI service does not rely on the ASP.NET SEssion, you will only have to configure the cache storage depending on the way it will be hosted - REST Service storage.


I hope the provided information is helpful.

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
Sean
Top achievements
Rank 1
answered on 23 Jan 2015, 04:52 PM
Hi Stef - 

Thanks again for your response. 

In many cases I'm sure switching to WebAPI might work. However I am specifically looking to access our existing ServiceStack sessions (via Redis). There are two reasons for this requirement that I can't seem to find any alternative for: 

1) Clients requesting a report will have already been authenticated by our API server using an IAuthProvider built into ServiceStack. The session is stored in the redis cache using a ServiceStack ICacheClient. I was hoping to be able to cause the Telerik reporting service to look in the same Redis cache for existing sessions to authenticate requests. This is fairly critical since we have a public API.

2) Each of our clients have their own database, each with an identical schema. Our session object, which extends the ServiceStack AuthUserSession class, contains the connection string for the authenticated client. When a client requests a report, I need to be able to get that connection string and use it for report generation. The dynamic connection string part seems to be fairly easy to do, so long as I can access the string from the user session.

In our own AppHost class (Which extends from AppHostBase, making it identical in function to your ReportsHostBase class), we use the following code to define our own auth and session providers: 

container.Register<IRedisClientsManager>(c =>
new PooledRedisClientManager("<OurRedisServer>"));

container.Register(c => c.Resolve<IRedisClientsManager>().GetCacheClient());

Plugins.Add(new AuthFeature(
    () => new PeruseUserSession(),
    new IAuthProvider[]
    { 
        new PeruseAuthProvider()
    }
) { HtmlRedirect = null } );

I was looking at another post where a user asked a very similar question to my own: http://www.telerik.com/forums/using-servicestack%27s-custom-authentication-with-telerik-reporting-services-servicestack

Is the response to that question still valid? From the information provided, it seems that user has ran into the same hangup as us. 

Thanks much for your help, 
- Sean H



0
Stef
Telerik team
answered on 28 Jan 2015, 02:50 PM
Hi Sean,

Telerik Reporting REST ServiceStack implementation does not support authentication with the described approach. We logged the issue for improvement in our system and your Telerik point are updated to thank you for pointing our attention to the problem.

My recommendation is to test using the approach from the using ServiceStack's custom Authentication with Telerik.Reporting.Services.ServiceStack forum thread to pass a key indicating the authorized user to the Reporting REST WebAPI. Then use the key to authorize the user's access to the service's methods and retrieve the required connection string. Via custom report resolver you can perform the connection strings replacement in the report e.g. check the approach in Changing the connection string dynamically according to runtime data.


Let us know if we can be of any further help for you.

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.

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