Previous Page Arrow Next Page Arrow

11.1 Overview of Service Operations

Service operations are operations that don’t fit naturally into the REST (resource / CRUD) mould. Here are some examples:

  • A computeSimplePrice function that takes a (productId, customerId, quantity) combination as input and produces a (unitPrice, quantityPrice, discount, tax) combination as output.

  • A computeOrderPrices function that takes a richer input. For example, where sales order in one application calls another application to request values, such as prices and discounts.

  • A manufactureOrder call that takes an order ID as input and causes the ERP to start the manufacturing process for the order.

  • A sendOverdueReminders call that causes the ERP to find customers with overdue invoices and email them a reminder.

SData uses a SOAP-like approach for service operations. Service operations are executed via an HTTP POST but SData uses a different envelope to package the raw XML data. The SOAP envelope is replaced by an Atom envelope, entry or feed depending on whether the operation manipulates a single entry or a collection of entries.

SData supports asynchronous operations. If the operation needs to return a result synchronously, it should be executed as a single HTTP request with the result in the HTTP response. For example, computeSimplePrice. This is only possible if the call completes quickly because the consumer would timeout otherwise. Whereas if the caller doesn’t need to get the result synchronously, and the call takes time to complete on the provider side, it should execute asynchronously. The caller has a standard way to interrogate the service and monitor the progress of the operation. For example, sendOverdueReminders. 

SData could take advantage of more HTTP features. In particular, operations that do not have side effects could be executed via a GET rather than a POST and the parameters could be passed as URL query parameters. But this would make the protocol more complex for little benefit. At least in this initial version, SData imposes the POST method for all service operations.
SData providers MAY expose any number of service operations (including none). SData providers that expose service operations MUST use the protocol described in the following pages.

Previous Page Arrow Next Page Arrow