locked
Batching and service operations RRS feed

  • Question

  • Can a client make batch request to Service Operation ?
    Using simple service as described here:
    http://msdn.microsoft.com/en-us/library/cc668788.aspx

    Normal request to OrdersByCity and batch request to OrderSet works fine, but batch request to OrdersByCity does not work, I am getting following error:

    <?xml version="1.0" encoding="utf-8" standalone="yes"?>
    <error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
      <code></code>
      <message xml:lang="en-US">An error occurred while processing this request.</message>
      <innererror xmlns="xmlns">
        <message>Object does not match target type.</message>
        <type>System.Reflection.TargetException</type>
        <stacktrace>   at System.Reflection.RuntimeMethodInfo.CheckConsistency(Object target)&#xD;
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)&#xD;
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)&#xD;
       at System.Data.Services.RequestUriProcessor.CreateFirstSegment(IDataService service, String identifier, Boolean checkRights, String queryPortion, Boolean&amp; crossReferencingUrl)&#xD;
       at System.Data.Services.RequestUriProcessor.CreateSegments(String[] segments, IDataService service)&#xD;
       at System.Data.Services.RequestUriProcessor.ProcessRequestUri(Uri absoluteRequestUri, IDataService service)&#xD;
       at System.Data.Services.DataService`1.BatchDataService.HandleBatchContent(Stream responseStream)</stacktrace>
      </innererror>
    </error>


    Code to make request:
                    Uri requestUri = new Uri(@"http://localhost:1927/Northwind.svc/OrdersByCity?city='London', UriKind.Absolute);
                    DataServiceRequest[] reqs = new DataServiceRequest[]
                    {
                        new DataServiceRequest<object>(requestUri)
                    };

                    ctx.BeginExecuteBatch(
                        (asyncResult) =>
                        {
                            try
                            {
                                ctx.EndExecuteBatch(asyncResult);
                            }
                            catch (Exception e)
                            {
                                System.Diagnostics.Debug.WriteLine(e.Message);
                            }

                        },
                        ctx,
                        reqs);





    Followup information:
    I am getting the same error with [WebInvoke] POST operations.
    Tuesday, December 23, 2008 11:11 PM

Answers

  • Found the answer here:

    http://social.msdn.microsoft.com/forums/en-US/adodotnetdataservices/thread/db746cd8-a3f6-42bc-bc9d-e976982f108a/

    "This is a known issue. We are looking to fix this in the future release."


    • Marked as answer by MichaelF77 Tuesday, December 23, 2008 11:42 PM
    Tuesday, December 23, 2008 11:42 PM