[Download] | [Documentation Home] | [Release Note]
Introduction
WSO2 Data Services Server provides the capability to support batch requests for operations, which contain multiple parameter sets for a single request. When a data service is created with the batch request mode set, for all the in-only operations (operations which does not have any return value), a corresponding batch operation will also be automatically created. This batch operation will taken in an array of parameters lists, compared to the single parameter list the non-batch operation require.
In order to make an operation supporting batch requests, first you need to enable the batch request functionality in the data service. Therefore, enable the batch request when creating the data service.
Figure 1: Create batch request support data service
Then you can define data sources, queries and operations for the data service. Figure 2 and Figure 3 show you the sample insert query and the operation created for that.
Figure 2: Insert query
Figure 3: Operation
Once the operations are created and the service is deployed, corresponding batch operation will be created according to the given operation. For the above sample operation "addEmployee", the corresponding batch operation is "addEmployee_batch_req". You can see this by clicking the "Try this service" as in the Figure 4.
Figure 4: Try it
You can use "try it" tool for testing the batch requests support. For that click on corresponding batch request operation. In this sample click on "addEmployee_batch_req" operation. This will give you a request SOAP body for inserting one data set as shown in the Figure 4.
You can change the request SOAP body to handle multiple requests by repeating the SOAP body use in single request. Figure 5 shows the request SOAP message for inserting two data sets using the "addEmployee_batch_req" operation.
Figure 5: Try it for handle batch requests