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

WPF ReportViewer consuming REST Services

6 Answers 204 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Matthias
Top achievements
Rank 1
Matthias asked on 02 Jun 2016, 12:32 PM
Hi,

according to the release history of Telerik Reporting R2 2016 the WPF ReportViewer now supports showing reports from Telerik Reporting REST Service. So I implemented a web application as described in the docs (http://docs.telerik.com/reporting/telerik-reporting-rest-host-http-service-using-web-hosting) and setup a WPF client application with the help of these articles:
http://docs.telerik.com/reporting/wpf-report-viewer-howto-use-it-with-reportserver
http://docs.telerik.com/reporting/report-engine-connectionstring#rest-service-engine

The XAML of the client now looks as follows:
1.<tr:ReportViewer x:Name="ReportViewer1" HorizontalAlignment="Stretch" ReportEngineConnection="engine=RestService;uri=http://localhost:19021/api/reports">
2.    <tr:ReportViewer.ReportSource>
3.        <telerikReporting:UriReportSource Uri="TestReport.trdp" />
4.    </tr:ReportViewer.ReportSource>
5.</tr:ReportViewer>


I also tried setting the Uri-Property of the UriReportSource to the full Uri or leaving out the trdp extension but the viewer only contains this error message:

Attempt by method 'Telerik.Reporting.Services.HttpClient.HttpRequestHelper.GetResponseFromPost(System.Net.Http.HttpResponseMessage)' to access method 'Telerik.Reporting.Services.HttpClient.HttpRequestHelper.GetResponseFromPost<T>(System.Net.Http.HttpResponseMessage, System.Collections.Generic.IEnumerable`1<System.Net.Http.Formatting.MediaTypeFormatter>)' failed.

Because I couldn't find much documentation about using the REST services with the WPF ReportViewer I could use some help.

Thanks
Matthias

6 Answers, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 07 Jun 2016, 12:03 PM
Hello Matthias,

It looks like an issue when you use the latest versions of the WebAPI Clients libraries Nuget package. Binding redirects seem to not work. Using the older versions should avoid the issue.

The question is forwarded to our development team and I will update this thread when there is news.


For anyone interested,the WPF ReportViewer can be connected to Telerik Report Server or a Reporting REST Service by address - How To: Use WPF Report Viewer with Report Server. details how to create the connection are available in ReportEngineConnection Property.

Regards,
Stef
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Accepted
Stef
Telerik team
answered on 07 Jun 2016, 12:40 PM
Hello,

It appears the WPF ReportViewer is designed to work only with the version of Microsoft.AspNet.WebApi.Client suitable for .NET4, in order to avoid API changes required by newer versions dependent on .NET4.5.

Please uninstall the added Nuget packages, and install this one via Package Manager Console.

Regards,
Stef
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Matthias
Top achievements
Rank 1
answered on 14 Jun 2016, 01:12 PM

Hello Stef,

thanks. That worked.

But now I got another problem connecting to my existing web api server component using windows authentication.

In my WPF application where I consume the web api I connect using a HttpClient using this piece of code:

1.HttpClientHandler authHandler = new HttpClientHandler()
2.{
3.    Credentials = CredentialCache.DefaultNetworkCredentials
4.};
5.var httpClient = new HttpClient(authHandler);

How can I tell the WPF report viewer to use windows authentication?

0
Stef
Telerik team
answered on 15 Jun 2016, 01:28 PM
Hi Matthias,

On connecting the WPF ReportViewer, you can submit credentials to the connected Reporting REST service (of a custom application or of a Telerik Report Server). The connection is specified through the viewer's ReportEngineConnection property. Please check the options of the connection in the linked article.

The connected Telerik Report Server can be configured to work with ADFS - Configuring Report Server to be used with external authentication provider.
then you can send user/pass on configuring the viewer's ReportengineConnection.


The connected custom application with Reporting REST service can be configured to accept authorization tokens and others. the Reporting REST WebAPI service is a WebAPI controller which methods can be overridden to include attributes and custom code for authorizing the access to resources.

Regards,
Stef
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Matthias
Top achievements
Rank 1
answered on 16 Jun 2016, 06:46 AM

Hi Stef,

I know how to configure the WebAPI and already did. The problem I'm facing is, that I don't know how to tell the WPF Report Viewer to send the windows credentials of the current windows account (not the username/password).

My client application is already talking to the other components of my WebAPI-App using the code snippet I posted earlier. I couldn't find any hint, neither in the docs (ReportEngineConnection only supports user/pass or token) nor in the reporting source code.

The only thing I can think of, is to override the instantiation of the HttpClient inside the WPF ReportViewer. But how can I do that?

Thanks
Matthias

0
Stef
Telerik team
answered on 21 Jun 2016, 07:19 AM
Hi Matthias,

Apologies for the misunderstanding.

After forwarding the question to our development team, It appears we create the HttpClient internally and only tokens can be submitted by the client.

Please feel free to log a feature request for extending the authentication mechanism to allow Windows Authentication from viewers integrated with a Reporting REST service or Telerik Report Server.

Regards,
Stef
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Matthias
Top achievements
Rank 1
Answers by
Stef
Telerik team
Matthias
Top achievements
Rank 1
Share this question
or