WCF Data Service WebGet Service Operation - 404 not found

5 posts, 0 answers
  1. Bobby Ross
    Bobby Ross avatar
    18 posts
    Member since:
    Nov 2004

    Posted 23 Apr 2012 Link to this post

    I have began a model and created a WCF Data Service to handle some custom data that needs to be returned from the service.  I attempted adding a custom WebGet Service Operation and continually get a 404 File Not found when navigating.

    My Svc file is as follows:
    [System.ServiceModel.ServiceBehavior(IncludeExceptionDetailInFaults = true)]
    public partial class MyEntitiesModelService : OpenAccessDataService<MyEntities.MyEntitiesModel>
    {
        public static void InitializeService(DataServiceConfiguration config)
        {
            config.SetEntitySetAccessRule("Vendors", EntitySetRights.All);
            config.SetEntitySetAccessRule("UserSettings", EntitySetRights.All);
             
            config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
     
            config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
        }
     
        [WebGet]
        public string Hello(string name)
        {
            return "Hello " + name;
        }
    }

    Not sure what I am doing wrong as declaring [WebGet] attribute and ServiceOperationAccessRule should be all that is required in order to call the method even from the browser.

    Also if I set config.SetServiceOperationAccessRule("Hello", ServiceOperationRights.All) instead of using a wildcard(*) the service throws an exception.

    Any help would be appreciated...
  2. Ian
    Ian avatar
    26 posts
    Member since:
    Jun 2012

    Posted 23 Apr 2012 Link to this post

    I have done some digging in the OData provider (v2) that OpenAccess uses as I've adapted it for use with the CTP for WCF Data Services v3.  This was done by grabbing the code for the relevant classes from the Telerik.OpenAccess.DataServices.dll (4 classes plus an interface I think).  I was using JustDecompile but it choked on one of the methods so I switched to ILSpy :)

    Anyway, in the IEnumerable<ServiceOperation> ServiceOperations() method, the decompiled code was simply "yield break;" - no service operations...
    Thus I think that to use ServiceOperations with an OpenAccess-backed WCF Data Service Telerik need to write some code.  I could be wrong - it's a tricky thing following all of the various classes and interfaces making up WCF Data Services (I also tried to link it in with Castle Windsor's not well documented WCF facilities) so I could be completely wrong, but I would think the decompiled code would surely have to have more than a "yield break;" to implement service operation support.
  3. DevCraft banner
  4. Viktor Zhivkov
    Admin
    Viktor Zhivkov avatar
    291 posts

    Posted 25 Apr 2012 Link to this post

    Hello Bobby and Ian,

    I am sorry for the inconvenience caused. The issue that you describe is known and we will fix it in a future release of OpenAccess. You are right that our implementation for the GetServiceOperations method is incomplete.

    While we are working on the proper implementation you can use the following workaround - create a separate service and add there all your custom service methods.

    We will do our best to fix this issue in OpenAccess 2012 Q2 build and we will notify you when the fix is available.

    Regards,
    Viktor Zhivkov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the OpenAccess ORM, subscribe to their blog feed now.
  5. Bobby Ross
    Bobby Ross avatar
    18 posts
    Member since:
    Nov 2004

    Posted 25 Apr 2012 Link to this post

    Thank you for your responses...  Will be watching for the fix when it is available....
  6. Ian
    Ian avatar
    26 posts
    Member since:
    Jun 2012

    Posted 25 Apr 2012 Link to this post

    Thanks for the info.  I have started using the workaround you provided anyway as I needed more functionality than what the ServiceOperations can provide (duplex calls, etc) so it didn't bother me.  I suppose it might have helped if I at least reported the deficiency.  Looking forward to the next release anyway.  Great tools! :)
Back to Top
DevCraft banner