...
- Click Add New Query to open the Add New Query screen.
- Enter the following values:
- Query ID: In this field, enter webquery as the query ID.
- Datasource: In this field, select the datasource for which you are going to write a query. Select the web datasource that you created previously.
- Scrapper Variable: When you add a query to a Web datasource, you must enter a Scraper Variable. This scraper variable must be the same as the output name in the web datasource configuration, which returns the output from the configuration. In this example, the
var-def
name in the configuration isweatherInfo
AppInfo
(<
var-def
name
=
'AppInfo'
>
).
- Define Output Mapping: Now, let's specify how the data fetched from the datasource should be displayed in the output. We will create output mappings for the following data in the web resource: Title and Description.
- 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.
- 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. Enter AppInfo in this field.
- In the Row Name field, specify the XML element that should group each individual result. Enter App in this field.
- Click Add New Output Mapping to start creating the output mapping for the Title field. Enter values as shown below:
- Click Add to save the output mapping.
Now, add another output mapping for the Description column.
You will now have the following output mappings listed for the webquery query:
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.
- Click Save, to save the query.
- Click Next to go to the Operations screen.
Defining and operation to invoke the query
Follow the steps given belowYou need to define an operation, to expose data as a SOAP service.
- Click Add New Operation to open the Add New Operation screen.
- In the Operation Name field, enter GetResource.
- In the Query ID field, select WebQuery.
- 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
...