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

HTTP Error 415 - WCF Load on Demand

5 Answers 175 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Eyal
Top achievements
Rank 1
Eyal asked on 31 Jul 2011, 12:06 PM
Hi,
I have a RadTreeView in which I want to load the child nodes on demand (as it says in the Demo) using a WCF service I published to my Sharepoint Site.
The service works fine when I initialize the tree on runtime (I get the root's children when the page loads) however, when I open a node I get "The server method 'GetChildNodes' failed", using Fiddler I checked the source of the error and saw this:

"HTTP/1.1 415 Cannot process the message because the content type 'application/json; charset=utf-8' was not the expected type 'text/xml charset=utf-8'."

What am I doing wrong here?

Thanks!

5 Answers, 1 is accepted

Sort by
0
Helen
Telerik team
answered on 03 Aug 2011, 12:26 PM
Hi Eyal,

Probably you will find helpful some of the following links:

http://meronymy.blogspot.com/2011/05/fixing-wcf-json-applicationjson-not.html
http://social.msdn.microsoft.com/forums/en-US/wcf/thread/ca11b6f5-dc86-49c4-9ade-e4ea3b5f7d4d
http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/2a64a217-6b75-41df-bf05-98e077635047/

Greetings,
Helen
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Eyal
Top achievements
Rank 1
answered on 04 Aug 2011, 11:16 AM
Hi Helen,
First of all thanks for your reply,
After using the attribute WebInvoke telling the OperationContact to expect JSON I was able to get data To and Back from my WCF service(!!), The problem now is that I get a JS exception regarding the JSON that was sent back:

"Sys.Net.WebServiceFaildException: The server method 'GetChildNodes' returned invalid data. The 'd' property is missing from the JSON wrapper."

Using fiddler again I compared the response I get from my own WCF service and the one in the demo and I can see that the 'd' property is indeed missing (*Duh*), How than can I wrap my response JSON with the 'd' property?

Thanks!
0
Helen
Telerik team
answered on 04 Aug 2011, 01:27 PM
Hello Eyal,

Take a look at the following forum post:
http://forums.asp.net/t/1492772.aspx/1
See the last reply.

Regards,
Helen
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Eyal
Top achievements
Rank 1
answered on 07 Aug 2011, 12:18 PM
Hi again Helen.

I've read the posts and understand that perhaps I need to Serialize the JSON myself, However in that case the implementation of the Service will not be as it is in your Demo. i.e. the server method will return a string and not RadTreeNodeData[].
Is this even recommended? Am I the only one who encountered this issue?

Thanks again for helping me out!

Eyal
0
Helen
Telerik team
answered on 08 Aug 2011, 02:11 PM
Hello Eyal,

Please review the following kb article:
http://www.telerik.com/community/forums/aspnet-ajax/treeview/wcf-support-for-treeview-load-on-demand.aspx

Regards,
Helen
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
TreeView
Asked by
Eyal
Top achievements
Rank 1
Answers by
Helen
Telerik team
Eyal
Top achievements
Rank 1
Share this question
or