Response from REST Collections Service??

Thread is closed for posting
4 posts, 0 answers
  1. Dave
    Dave avatar
    3 posts
    Member since:
    May 2012

    Posted 09 May 2012 Link to this post

    Hi All,

    I am new to Telerik and I am currently trying to implement a Restful Web Service App that will accept Http injects and either display or process data. I have performed the following steps and I am having trouble:

    1. I have created a new Class Library project in visual studio.
    2. I then added a "Telerik OpenAccess Domain Model" to that project and successfully linked it to my database.
    3. I then Added a web project to my solution.
    4. I then used the Data Services Wizard (DWS) to create a REST Collections for the app, this was successful.
    5. From this a number of files were added to the project icluding ICollectionService.cs, DataManager.cs, Users.svc etc.

    From here I then wanted to view the data in my database in xml or json. I setup some routing so that i could more easily access the service, as shown below:

    Global asax.cs

    using System;
    using System.ServiceModel.Activation;
    using System.Web;
    using System.Web.Routing;
    namespace WcfRestService1
        public class Global : HttpApplication
            void Application_Start(object sender, EventArgs e)
            private void RegisterRoutes()
                // Edit the base address of Users by replacing the "Users" string below
                RouteTable.Routes.Add(new ServiceRoute("Users", new WebServiceHostFactory(), typeof(Users)));

    Once I then run the application and went to the routing address which should have pointed me to the Service I got an error saying is not compatible with, so I added the below code to the Users.svc.cs to fix it:

    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]

    Now When I run the application and go to say the following address "http://localhost:14644/Users/", I get the results as shown below where as I would like it to show me the data in an XML/Json format.


    Can anyone please help with this? If you need more info please let me know.


  2. Dave
    Dave avatar
    3 posts
    Member since:
    May 2012

    Posted 09 May 2012 Link to this post

    I have managed to modify the data but now I am not sure exactly how I can create new Database entries using the REST Collections? I would like to create a new database entry using the value passed by a query string, can anyone help?

  3. Dave
    Dave avatar
    3 posts
    Member since:
    May 2012

    Posted 11 May 2012 Link to this post


    So I have got a little further with this and by passing data to the Web Services I am able to do most things apart from Creating New Entries. I believe this is to do with the structure of the data I am sending to the service, can someone please help me with this?? I have included the data I am sending to the service below along with the error I get:

    Accept: application/atom+xml
    Content-Type: application/atom+xml;type=entry
    Host: localhost:16485
    Content-Length: 242

    <User xmlns="">

    catch (OpenAccessException)
                    throw new Exception(Convert.ToString(HttpStatusCode.BadRequest));

    The error is thrown by the function above but it is not specific on what is the cause.

  4. Serge
    Serge avatar
    375 posts

    Posted 13 May 2012 Link to this post

    Hello Dave, 

     First of all I would like to point out that there is a new wizard that now handles the creation of services using OpenAccess. You will find it by right clicking on either an rlinq file or an web application in the solution explorer and selected "Generate OpenAccess Domain Service". 

    As to the problems you are experiencing I will suggest attaching a debugger to the web project that is hosting the service and having a look at the actual exception. 

    Another thing to consider is implement a WCF Data Service instead. They are quite easy to setup and also generated by our wizard. The Data Services are also REST oriented so this shouldn't be a problem. 

    I hope this is helpful.
    the Telerik team
    Follow @OpenAccessORM Twitter channel to get first the latest updates on new releases, tips and tricks and sneak peeks at our product labs!
Back to Top