The web service web part enables you to connect to web service end points. This web part requires that you specify a web service URL and it implements a GetDataSet()
method. The Kentico WebProject contains an example that can be customized. Let's create an example of a web service that allows you retrieve a lunch list using a GetDataSet()
method and the following steps.
1. In the Kentico CMS WebProject, double-click the
\App_Code\CMSPages\WebService.cs
file, as shown in the following screenshot:2. In the WebService.cs
GetDataSet()
method, replace the existing code with the following:/// <summary> /// Returns the data from DB /// </summary> /// <param name="parameter">String parameter for sql command</param> [WebMethod] public DataSet GetDataSet(string parameter) { // INSERT YOUR WEB SERVICE CODE AND RETURN THE RESULTING DATASET //-- Instantiate the data set and table DataSet lunchDS = new DataSet(); DataTable lunchTable = lunchDS...