A Web Service as a Data Source

Configuring a web service as a data source follows the same first steps as for other data sources. The first place where it differs is (obviously) at the point where you choose the type of data source:
configuration-web service

When you press the “Finish” button, the data source will be entered into the Configuration window with a default name.  Change the name to something you like, press TAB and then press the “Use Data Source’s Editor” button to configure the specific properties of this data source.

You will then be given a place into which to type the data source Definition String.  This is the URL of the web service, with the string “<id>” indicating where  a parameter can be inserted.  The format of this string will depend on the actual web service in question.

Suppose the web service returns information about a particular user, and you would normally enter something like:

http://UserInformation.com/getuser.aspx?userid=fred

which would get the information for the user whose “userid” is “fred”.

The data source Definition String would then be entered as

http://UserInformation.com/getuser.aspx?userid=<id>

To access this information in the template, the LinkToDataSource command would be used, as in the following example.

Firstly, suppose the name of the data source was defined in the configuration as UserDataSource, and that the userid required by the web service is captured in the interview by:

«CaptureDataElement(User_Id)»

Then the web service data would be retrieved (and included in the dataset) by:

«LinkToDataSource(User_Id,UserDataSource,,id=<User_Id>)»

It goes without saying that the format of the data returned by the web service must be XML.