Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This tutorial will guide you on how to expose data in a CSV file as a data service by using the  Create New Data Service wizard. We will create a data service that can search for data on the file.

...

  1. Click Add New Query to open the Add New Query screen.
  2. In the Query ID field, enter an identifier for the query. We will enter Q1.
  3. In the  Datasource  field, select the datasource for which you are going to write a query. Select the CSV  datasource that you created previously.
  4. Now let's specify output mappings, which will determine how the result from your query will be presented when the query is invoked.  The sample CSV  datasource  we are using contains three columns: ID, Name, Category and Price. We will create an output mapping for each of these columns.  
    1. In the Output type field, specify the format in which the query results should be presented. You can select XML, JSON or RDF. We will use XML for this tutorial.
    2. In the Grouped by element field, specify a grouping for all the output mappings. This will be the XML element that will group the query result. We will enter Products.
    3. In the Row Name field, specify the XML element that should group each individual result. Enter Product  in this field.
    4. Click Add New Output Mapping to start creating the output mapping for the ID column. Enter values as shown below:
    5. Click Add to save the output mapping. You will now have one output mapping listed for the Q1 query as shown below.
    6. Click Add again (see the screen above), and You can now create output mappings for the remaining columns given below.

      Mapping TypeElement NameDatasource TypeDatasource Column NameParameter TypeSchema Type
      ElementCategoryColumnClassificationSCALARstring
      ElementPriceColumnPriceSCALARstring
      ElementNameColumnNameSCALARstring
    7. Once you have created all the output mappings, click Main Configuration to return to the Edit Query screen.

      Info

      Find out more about defining Output Mappings.

  5. Click Save, to save the query.
  6. Click Next to go to the Operations screen.

Define an operation to invoke the query

To invoke the query, you You need to define an operation to expose data as a SOAP service.

  1. Click Add New Operation to open the following screen.
  2. In the  Operation Name  field, enter a name for the operation.
  3. In the Query ID  field, select the query that you created.
  4. Save the operation.

Finish creating the data service

Once you have defined the operation, In this tutorial, we are only defining a SOAP service to expose the data. Therefore, you can click Finish to complete the data service creation process, after defining the operation. You will now be taken to the  Deployed Services screen, which shows all the data services deployed on the server.

Info

If you click Next after defining the operation, you will be taken to the Add Resources screen, which allows you to expose the data as a REST resource. If you want to create a REST resource, see Exposing Data as a REST Resource for information.

...

Invoking your data service

...