[Download] | [Documentation Home] | [Release Note]

CSV Sample

Introduction

Usage of CSV files is an easy and a common way of storing simple tabular data. In this sample, it demonstrates the usage of a CSV file as a data source in WSO2 Data Services Server.

Prerequisites

The sample data service "CSVSampleService" should be deployed as per the instructions mentioned in Deploying Samples section.

Running the Sample

The sample service can be run using the "tryit" tool, which is bundled with WSO2 Data Services Server, or a code-generated java client sample using this service is demonstrated in the Data Services Clients Sample section.

CSV File Contents

The CSV file (CARBON_HOME/samples/resources/Products.csv) contains data about the products that are manafactured in an automobile company. So here the products refer to cars/motorocyles. The data table has "ID, Name, Classification, Price" columns.

Service Definition

The CSV data source based data service contains a single operation "getProducts" to list all the products that are manufactured in the company.

Sample Run

A sample run of the service using the "tryit" tool is shown below.


Figure 1: CSV data source based service invocation.