Using CSV files is an easy and common way of storing simple tabular data. This sample demonstrates the usage of a CSV file as a data source for data services in WSO2 DSS.
About the sample
The CSV file (
Products.csv), stored in the
<DSS_HOME>/samples/resources/ folder contains data about the products that are manufactured in an automobile company. Products refer to cars/motorocyles. The data table has the following columns: "ID", "Name", "Classification" and "Price". The sample data service used in this demonstration (
CSVSampleService.dbs) contains a single operation named getProducts , which lists all the products that are manufactured in the company.
See Data Services and Resources for a definition of data services and operations.
Building the sample
The sample data service named
CSVSampleService should be deployed using the instructions in .
Executing the sample
The sample service can be run using the tool, which is bundled with the WSO2 Data Services Server, or a code-generated java client sample as discussed in the section.
Follow the steps below to demonstrate this functionality using the TryIt tool:
- Log in to the management console of your server and click List under Services in the navigator. The
CSVSampleServicewill be listed here.
- Click Try this service to open the TryIt tool.
- Select the "getProducts" operation and click Send to execute the request. You will get a product list in the response as shown below.