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

Using DataSource to read from dynamically generated XML

8 Answers 415 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Patrick
Top achievements
Rank 1
Patrick asked on 25 Oct 2011, 07:29 PM
I'm writing a web app that calls an ASP.NET web service which retrieves data from a MySQL database and returns the response in XML. However, I'm having trouble getting this to work without a static XML file, I would like to pass the XML response directly to jquery. Below is my code, any help would be appreciated. I had also tried passing the XML response to javascript and generated an XML object which I passed to Kendo's Datasource, which didn't work either. 

Also, if it's not possible, is it bad practice to create temporary XML files for each call to the web service?

$(document).ready(function() {
    $("#grid").kendoGrid({
        dataSource:  new kendo.data.DataSource({
            transport: {
                read: {
                    url: "WebService.asmx/HelloWorld", //had also tried absolute path 
                    datatype: xml
                }
            },
            schema: {
                type: "xml",
                data: "/NewDataSet/Group",
                model: {
                    fields: {
                        rowid: "rowid/text()",
                        group_id: "group_id/text()",
                        group_name: "group_name/text()",
                    }
                }
            }
        }),
        scrollable: false,
        sortable: true
    });
});


8 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 26 Oct 2011, 10:06 AM
Hello Patrick,

Unfortunately, it seems to be ok on my end. I have attached a basic test project  which try to recreate the issue. Please take a look maybe I'm missing something obvious. 

Also could you verify that the service is returning the actual data in the correct format. 

All the best,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Patrick
Top achievements
Rank 1
answered on 26 Oct 2011, 07:21 PM
Hello Rosen,
I appreciate your help. Unfortunately I wasn't able to open the solution with my version of VS (I can only use VS 2008 and IIS7.5). However I was able to copy your code into my project but I'm having the same problem. Btw, the Chrome developer console shows:  GET http://localhost:83/TestService.asmx/HelloWorld 500 (Internal Server Error)
  
I have attached a very simple test project. If you could take a look it would be greatly appreciated.

Basically what I did is as follows:
  • 1) In VS2008, Create new ASP.NET Website.
  • 2) Add a Web Service item to the project
  • 3) Copy your code to my Default.aspx and TestService.asmx accordingly
  • 4) Add the Website to IIS and open localhost/Default.aspx  
Thank you,
Patrick
0
Patrick
Top achievements
Rank 1
answered on 27 Oct 2011, 08:01 AM
By the way, I'm restricted to .NET 3.5 framework for this project. Will this be possible on 3.5?
0
Accepted
Rosen
Telerik team
answered on 27 Oct 2011, 08:24 AM
Hello Patrick,

The error is caused by the fact that the service in the attached solution is not configured to allow GET requests as opposite to the one in the project I have provided:

web.config

<system.web>
    .....   
  <webServices>
    <protocols>       
      <add name="HttpPost"/>
      <add name="HttpGet"/>
    </protocols>
  </webServices>
</system.web>

Regarding the version of .NET, as you know KendoUI is a javascript library, therefore it is not dependent on any server technology and it is up to the developer to integrate it into his own server platform.
All the best,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Patrick
Top achievements
Rank 1
answered on 27 Oct 2011, 08:30 AM
That worked! Thank you so much, you're a life saver!
0
Patrick
Top achievements
Rank 1
answered on 29 Oct 2011, 08:34 PM
Unfortunately, this code fails in IE8. Any idea how to get it working in IE8? 
0
Rosen
Telerik team
answered on 31 Oct 2011, 09:17 AM
Hi Patrick,

Indeed, we are aware of this issue and it has been already fixed. The fix will be available with the next version of the library. 

All the best,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Congero
Top achievements
Rank 1
answered on 29 Mar 2012, 10:36 AM
.
Tags
Data Source
Asked by
Patrick
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Patrick
Top achievements
Rank 1
Congero
Top achievements
Rank 1
Share this question
or