[Download] | [Documentation Home] | [Release Note]
Introduction
WSO2 Data Services Server supports to expose data in Excel 97-2007 as a service.
Sample Excel Data sheet
Before we start on create the data service we will create an excel sheet which contains three columns, namely ID, Model and Classification (i.e. Do not paste the above content into a single cell). Fill the data sheet with some values under those three columns.
Figure 1: Sample excel data sheet
Step 1: Start by giving a name
Lets start create the data service by click on "Create" link under Manage/Services/Add/Data Service. We will name the service as ExcelSampleService. Click on "Next" button once you enter the name, and the description if required.
Figure 2: Create excel data service
Step 2: Enter details about your Excel file.
Next step is to provide the details about the excel file. Select the Data Source Type as "EXCEL" from the drop down list after you giving a name to the data source. Then enter the location of the excel file and save.
Figure 3: Configure data source
Created data source will list as below. Click on "Next" to create the query.
Figure 4: View data source
Step 3: Enter excel and query details using which values will be extracted, and configure how the response should look like
Lets name the Query Id as sheet1Query and select the data source which created in previous step amd fill the excel sheet details. Enter a name for Grouped By Element and Row Name. You can also give a namespace if you wish. Click on "Add Output Mapping" button to create how the output should look like. Lets create ID as an element and Name and Classification as attributes. Save the query once you enter the details.
Figure 5: Create querry
Once you add a query, it will be listed as follows. Click on "Next" to create the operation.
Figure 6: View querry
Step 4: Create a web service operation
Click on "Add on Operation", and enter a name to the operation. Lets name it as getProducts. Select the created query from the drop down list and save the operaion.
Figure 7: Add operation
Existing operations will be listed as follows. Click on "Finish" button. Service will be created and deployed.
Figure 8: View operations
Step 5: Service deployed
Now we have created a data service. You can go the deployed services list which is under Manage/Service/List. Created service will be list as follows.
Figure 9: Deployed data services
Step 6: Try your service
By click on "Try It" link you can invoke the created service.
Figure 10: Invoke service using Try-it
Click on the deployed service and click on "Edit Data Service(XML Edit)" to view the data service in xml format.
Figure 11: Ediit data service