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

Connecting a Telerik Report to an XML Data Source generated from a Web Service

4 Answers 439 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Lea
Top achievements
Rank 1
Lea asked on 12 Dec 2014, 08:55 AM
Hi Telerik, I am currently creating a report that will be generated using a Web Service. I am loading the XML Data through entering its path (can come from local machine / HTTP source) through xml.Load("path"). It returns the XML file as String (I'm not sure if this is good or bad). Now, how am I going to connect a Telerik 
Report to the XML file that was returned by the method that I have created on the Web Service? This is my first time creating a Web Service. I'm using VB as my programming language. Hope someone can help me thanks!

4 Answers, 1 is accepted

Sort by
0
KS
Top achievements
Rank 1
answered on 13 Dec 2014, 02:11 PM
Hi,

Create a method where the XML is loaded, and start with How To: Create a Report (Visual Studio), then go on with How To: Use the Report Wizard to create a Band Report where at step 4( Data Source Wizard) select an ObjectDataSource and the method loading the XML.

And the easiest is to check the demo at Connecting Telerik Reporting to OData feeds.

-KS
0
Lea
Top achievements
Rank 1
answered on 15 Dec 2014, 02:30 AM
Hi KS, 

Thanks for the suggestions. I already loaded the XML file into the project that I'm doing however I am having an issue with creating the report. When I added an item and chose "Telerik Report Wizard" my project encountered an error

"Could not find type 'Telerik.Reporting.Report'. Please make sure that the
assembly that contains this type is referenced. If this type is a part of your
development project, make sure that the project has been successfully built
using settings for your current platform or Any CPU."
 
When I tried adding a reference I cannot find the Telerik.Reporting.Report assembly (But I have successfully added one before and created a report in a simple project, this time I cannot add a report. Is there something that I did wrong this time? By the way I am using ASP. Net Web Service. Thank you very much.

0
Lea
Top achievements
Rank 1
answered on 15 Dec 2014, 03:26 AM
UPDATE

I've added Telerik.Reporting assemblies by changing the Target Framework from .NET Framework 3.5 to .NET Framework 4. I have successfully created the report. Will update this thread once I have successfully connected my XML Data Source to my report on the ASP. Net Web Service that I am currently doing. Thanks again, KS!

Lea
0
Lea
Top achievements
Rank 1
answered on 15 Dec 2014, 10:31 AM
UPDATE: Connected my Telerik Report to the XML Data Source on the Web Service

First, load your XML Data through the following code: (Note this code is not yet final, I'm still furnishing it. But it's already working)

'This code is located on your .asmx program
Public Function GenerateReport(ReportID As String, RecipeXML As String, Username As String) As String

        Dim xmlDoc As New XmlDocument()
        xmlDoc.Load("" + RecipeXML)
        
        XmlData_ = RecipeXML

    End Function

Also, do not forget to initialize a variable that can be accessed by your Report1.VB form

Public Shared XmlData_ As String 
'Make sure you initialize this before the function stated above

After that you can now create a Blank Telerik Report and put the code below

 Sub Connection()
        Dim ds As New DataSet()
        ds.ReadXml("" + XmlData_)
        Report.DataSource = ds.Tables("Ingredients")

    End Sub
'Make sure that you will call the Sub-Procedure "Connection()" after the "Initialize component()" on your Report.Vb form. 

Now that you have successfully connected your report and your data source, create a .aspx form and put a Report Viewer, set the Report Source to Report1.VB (Properties > Report Source > Browse the report you have created)

ISSUE:
Now the current issue that I am encountering is that I want my Web Service to return a URL / Link where in the User / Client can click it and then they will be redirected to the form that contains the preview of the report that I have created. (But in case that I will be able to do this, I will update this thread.) Thank you







Tags
General Discussions
Asked by
Lea
Top achievements
Rank 1
Answers by
KS
Top achievements
Rank 1
Lea
Top achievements
Rank 1
Share this question
or