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

Demo WebService isn't responding - Newbie Question

2 Answers 114 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
KI performance
Top achievements
Rank 1
KI performance asked on 14 Apr 2014, 01:12 PM
Hello everbody,

i am unable to configure my WCF WebService and RadTreeView Control to work together 'On Demand', and because i am absolutly new with WebServices, i have no clue what is the problem. Anybody can give me a hint? By the way, i strongly use the following Demo of Telerik: http://www.telerik.com/help/aspnet-ajax/treeview-load-on-demand-wcf.html and http://demos.telerik.com/aspnet-ajax/treeview/examples/programming/performance/defaultcs.aspx

myTopBarNavigation.svc

<%@ ServiceHost Language="C#" Debug="true"
    Service="xxxx.xxxx.layout.ISAPI.xxxx.xxxx.xxxx.myTopBarNavigation,SharePoint.Project.AssemblyFullName$" 
    CodeBehind="myTopBarNavigation.svc.cs"
    Factory="Microsoft.SharePoint.Client.Services.MultipleBaseAddressWebServiceHostFactory,
    Microsoft.SharePoint.Client.ServerRuntime,
    Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

myTopBarNavigation.svc.cs

namespace kibp.nordlb.layout.ISAPI.kibp.nordlb.layout
{
     class NodeData
    {
        private string text;
        public string Text
        {
            get { return text; }
            set { text = value; }
        }
    }
 
    //[BasicHttpBindingServiceMetadataExchangeEndpoint]
    [ServiceContract]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    class kibpTopBarNavigation
    {
         [OperationContract] 
        public IEnumerable GetNodes(RadTreeNodeData node, IDictionary context)
        {
            int numberOfNodes = 100;
            List<NodeData> nodes = new List<NodeData>();
            for (int i = 0; i < numberOfNodes; i++)
            {
                NodeData nodeData = new NodeData();
                nodeData.Text = "Node " + i;
                nodes.Add(nodeData);
            }
             return nodes;
        }
    }
}

Error Message @Fiddler:

HTTP/1.1 500 System.ServiceModel.ServiceActivationException

P.s.: The Request looks like this:


and tries to send the following Data:

{"node":{"Text":"Root Node","Value":null,"Key":null,"ExpandMode":3,"NavigateUrl":null,"PostBack":true,"DisabledCssClass":null,"SelectedCssClass":null,"HoveredCssClass":null,"ImageUrl":null,"HoveredImageUrl":null,"DisabledImageUrl":null,"ExpandedImageUrl":null,"ContextMenuID":"","Checked":false},"context":[]}




2 Answers, 1 is accepted

Sort by
0
KI performance
Top achievements
Rank 1
answered on 14 Apr 2014, 01:38 PM
I've build a Interface with following Content:

myTopBarNavigationInterface.cs

namespace xxxx.xxxx.xxxx.ISAPI.xxxx.xxxx.xxxx
{
    [ServiceContract]
    interface myTopBarNavigationInterface
    {
 
        [OperationContract]
        [WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.WrappedRequest, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        IEnumerable GetNodes(RadTreeNodeData node, IDictionary context);
    }
}

modified: myTopBarNavigation.svc.cs

namespace xxxx.xxxx.xxxx.ISAPI.xxxx.xxxx.xxxx
{
 
    class NodeData
    {
        private string text;
 
        public string Text
        {
            get { return text; }
            set { text = value; }
        }
    }
 
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    class myTopBarNavigation : myTopBarNavigationInterface
    {
        public IEnumerable GetNodes(RadTreeNodeData node, IDictionary context)
        {
            int numberOfNodes = 100;
            List<NodeData> nodes = new List<NodeData>();
            for (int i = 0; i < numberOfNodes; i++)
            {
                NodeData nodeData = new NodeData();
                nodeData.Text = "Node " + i;
                nodes.Add(nodeData);
            }
 
            return nodes;
        }
    }
}

With this modified edition, i see that the WebService is called and it jumpes into the correct function. Btw. i dont know why but the webservice is called three times and the page returns 401 as error, but this is another story :)
0
Hristo Valyavicharski
Telerik team
answered on 17 Apr 2014, 11:48 AM
Hi Sascha,

Does this mean that the problem is solved?

Regards,
Hristo Valyavicharski
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
TreeView
Asked by
KI performance
Top achievements
Rank 1
Answers by
KI performance
Top achievements
Rank 1
Hristo Valyavicharski
Telerik team
Share this question
or