Hi there, I need to invoke a BusinessRule via SData after creating an entity. I used the approach of Mike LaSpina in this thread but without success.
Here's the code:
SDataServiceOperationRequest sreq = new SDataServiceOperationRequest(base.NewSDataService()) { ResourceKind = "licenseorders", OperationName = "GetDataFromServiceNetMailWrapper" }; sreq.Entry = new AtomEntry(); sreq.Entry.SetSDataPayload( new SDataPayload { ResourceName = string.Format("LicenseOrder{0}", sreq.OperationName), Namespace = "http://schemas.sage.com/dynamic/2007", Values = { { "request", new SDataPayload { Values = { { "licenseorderId", licenseorder.id } } } } } }); AtomEntry entry = sreq.Create(); SDataPayload response = entry.GetSDataPayload().Values["response"] as SDataPayload; result = response.Values["Result"].ToString().ToLower() == "true";
I'm using the SDataCSharpClientLib v1.2.2.1335 (via NuGet) The licenseorder has been created before and the licenseorder.id is valid. The value licenseorderId is the parameter that the wrapper function needs to perform the wrapped operation.
It gives me the following error: (404) Not found.
The uri being called is: http://servername:port/sdata/slx/dynamic/-/licenseorders/$service/GetDataFromServiceNetMailWrapper
If I open http://servername:port/sdata/slx/dynamic/-/licenseorders/$service in a browser, it shows me the original BusinessRule named GetDataFromServiceNetMail but not the wrapping method.
Am I doing something wrong? Am I using the wrong version of the SDataCSharpClientLib? |