How to get complete OData url?

1 Answer 528 Views
.NET 5 Accessibility DataSource WebService General Discussions Report Viewer - HTML5
Tursunkhuja
Top achievements
Rank 2
Iron
Iron
Veteran
Tursunkhuja asked on 06 May 2021, 10:46 AM

Hi,

We use Web service datasource almost in all of our reports. In web service datasource we use OData query to get some information from our server. We usually customize web service data sources by using inline parameter @url to set value for Service Url property. Inline @url parameter will be calculated based on some formula (see ConfigureRequestParameters.PNG attached picture, @url parameter value can be complex). We use Html5ReportViewer, .NET5.

The question here is how to get complete odata url for the specific webservice datasource of the report programmatically (we also implemented custom report resolver in our project)? Meaning that what will be the final version of OData url on execution process?  

As a sample report you can use attached report (TestProductReport.zip).

What we want is to get this complete odata url:

 https://services.odata.org/V3/Northwind/Northwind.svc/Products?$select=ProductID,ProductName,UnitPrice

In design mode you see ConfigureRequestParameters.PNG.

Thanks,

1 Answer, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 11 May 2021, 07:06 AM

Hello Tursunkhuja,

If I understood correctly, you would like to get the evaluated final URL for the WebServiceDataSource.

Our code evaluates the WebServiceDataSource URL once and stores it in a short-living variable that is used only for data extraction. We haven't exposed any public API to obtain this value as we don't see a reason for this. Can you elaborate on the scenario that would require this URL to be available for the user?

Generally, you should be able to evaluate the URL value with custom code. The Expression is known, or you may get it from the WebServiceDataSource properties in the report definition. The Report Parameter values are also available in the Resolve method of the custom ReportSource resolver. Hence, you may try to construct the final URL in the resolver.

Regards,
Todor
Progress Telerik

Тhe web is about to get a bit better! 

The Progress Hack-For-Good Challenge has started. Learn how to enter and make the web a worthier place: https://progress-worthyweb.devpost.com.

Tursunkhuja
Top achievements
Rank 2
Iron
Iron
Veteran
commented on 11 May 2021, 08:10 AM

Hello Todor,

As a scenario, for example we created/designed a report and when previewing the report it may show error because of the OData query of WebServiceDataSource is not correctly designed, etc. This can help us to debug our report.

For example, recently we had problem related with "Float" type (See https://www.telerik.com/forums/error-when-we-use-parameter-type-float). When we previewed our report on Standalone Report Designer it was working fine, but when we preview that report on Html5 Report Viewer it shows error (Internal Server Error...). In that case we want to get the evaluated final OData URL and test it with Postman.

Thank you.
Todor
Telerik team
commented on 14 May 2021, 07:29 AM

Hello Tursunkhuja,

Thank you for the clarification. We will discuss the requirement within the team.

Note that generally, the problem described in the Error when we use parameter type "Float" forum thread is related to the .NET Core framework rather than the URL.

Todor
Telerik team
commented on 14 May 2021, 02:10 PM

We discussed the requirement and I have logged a feature request to add the information in the Trace Log on your behalf - Add the evaluated WebServiceDataSource URL in the trace log so that the developer may test it.

Meanwhile, you may add the same Expression that is used for the WebServiceDataSource URL as a value of a TextBox so that it can be displayed when evaluated. If necessary, you may create a custom User Function that returns the final URL for the purpose.

You may also use Fiddler to see the exact URL.

Tags
.NET 5 Accessibility DataSource WebService General Discussions Report Viewer - HTML5
Asked by
Tursunkhuja
Top achievements
Rank 2
Iron
Iron
Veteran
Answers by
Todor
Telerik team
Share this question
or