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

WCF Data Service WebGet Service Operation - 404 not found

4 Answers 118 Views
Development (API, general questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Bobby Ross
Top achievements
Rank 1
Bobby Ross asked on 23 Apr 2012, 05:12 AM
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...

4 Answers, 1 is accepted

Sort by
0
Ian
Top achievements
Rank 1
answered on 24 Apr 2012, 01:22 AM
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.
0
Viktor Zhivkov
Telerik team
answered on 25 Apr 2012, 02:24 PM
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.
0
Bobby Ross
Top achievements
Rank 1
answered on 25 Apr 2012, 02:28 PM
Thank you for your responses...  Will be watching for the fix when it is available....
0
Ian
Top achievements
Rank 1
answered on 26 Apr 2012, 01:13 AM
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! :)
Tags
Development (API, general questions)
Asked by
Bobby Ross
Top achievements
Rank 1
Answers by
Ian
Top achievements
Rank 1
Viktor Zhivkov
Telerik team
Bobby Ross
Top achievements
Rank 1
Share this question
or