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

Unable to consume WCF Data Service using Kendo Grid?

6 Answers 476 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Ranjit
Top achievements
Rank 1
Ranjit asked on 15 Jun 2012, 10:56 PM
We are currently having issues calling the WCF data service from the Kendo Data Source object. 

Is there something wrong with this initialization? When running the developer tool in browser it returns 400 Bad Request from the service. 

Please help...



var dataSource = new kendo.data.DataSource({
        type: "odata",
        transport:
        {
            read:
            {
                url: "http://localhost:49266/AmRiscOnlineService.svc/tblLocations",
                dataType: "jsonp",
                data: { accId: '@ViewBag.AccountId' },
            }
        },
    });

6 Answers, 1 is accepted

Sort by
0
Iliana Dyankova
Telerik team
answered on 18 Jun 2012, 08:23 AM
Hi Ranjit,

The code snippet you provided looks OK, but I am afraid it is not enough to detect where the reason for the problem is. I think this code library project would be very useful for you - it illustrates remote CRUD data operations using WCF service. Please check it and let me know if the problem in your application still persist. 

 
Greetings,
Iliana Nikolova
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Guy
Top achievements
Rank 1
answered on 19 Jun 2012, 04:49 AM
Iliana,

That's an ASMX service.  How about a WCF4 service?

Guy
0
Fabien
Top achievements
Rank 1
answered on 13 Jul 2012, 10:19 AM
WCF Data Service does not support the query options $format and $callback needed to tell the service to return JSON instead of XML.
There is a workaround that consists to create a custom behaviour attribute that will handle these two query options.
Here is the blog post that describe the workaround: http://professionalaspnet.com/archive/2010/06/17/The-query-parameter-_27002400_format_2700_-begins-with-a-system_2D00_reserved-_270024002700_-character-but-is-not-recognized.aspx
0
Guy
Top achievements
Rank 1
answered on 13 Jul 2012, 12:38 PM
Thank you, Fabien.  Most awesome help.
0
hermann
Top achievements
Rank 1
answered on 30 Aug 2012, 03:49 PM
What about WCF Data Service 5?

I am desperately trying to create a WCF Data Service
with VS2012,
.NET 4.5
EntityFramework 5
WCF Data Service 5 (with default DBContext)

based  on the odata crud examples

var crudServiceBaseUrl = "/WcfDataService1.svc/Products",
    dataSource = new kendo.data.DataSource({
        type: "odata",
        transport: {
            read: {
                url: crudServiceBaseUrl,
                dataType: "jsonp"
            },
            update: {
                url: function (data) {
                    return crudServiceBaseUrl + "(" + data.ProductID + ")";
                }
            },

works with ObjectContext approach

but what is neccessary to make it run with
WCF Service based on DBContext ?

regards,
hermann
0
Oksana
Top achievements
Rank 1
answered on 10 Sep 2014, 04:28 PM
Hi Fabien!
The workaround link at http://professionalaspnet.com/archive/2010/06/17... is not available anymore.
Please provide another example how to use self hosting WCF as data source.
Tags
Data Source
Asked by
Ranjit
Top achievements
Rank 1
Answers by
Iliana Dyankova
Telerik team
Guy
Top achievements
Rank 1
Fabien
Top achievements
Rank 1
hermann
Top achievements
Rank 1
Oksana
Top achievements
Rank 1
Share this question
or