ActiveReports Developer 7
DataSet Web Service
See Also Support Forum
ActiveReports Developer 7 > ActiveReports Developer Guide > Samples and Walkthroughs > Walkthroughs > Web Services (Std Edition) > DataSet Web Service

Glossary Item Box

With ASP.NET, you can set up a Web Service that returns a dataset to use in ActiveReport Developer. This walkthrough illustrates how to create one.

This walkthrough is split into the following activities:

Note: For the information on how to connect your report to data and how to create the report layout, please see Single Layout Reports (for a page report) or Basic Data Bound Reports (for a section report).

ShowTo create an ASP.NET Web Service project

  1. From the File menu, select New Project.
  2. In the New Project dialog that appears, select ASP.NET Web Service Application.
  3. Change the name of the project.
  4. Click OK to open the new project in Visual Studio.

ShowTo create the Web Method

In the App_Code/Service.vb or Service.cs file that displays by default, replace the existing <WebMethod()> _ and HelloWorld function with code like the following.

ShowTo write the code in Visual Basic.NET

Visual Basic.NET code. Paste OVER the existing WebMethod. Copy Code
Private connString As String
<WebMethod(Description:="Returns a DataSet containing all Products")> _
Public Function GetProduct() As Data.DataSet
  connString = "Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=C:\Users\[User Name]\Documents\ComponentOne Samples\ActiveReports Developer 7\Data\nwind.mdb" Dim adapter As New Data.OleDb.OleDbDataAdapter("select * from products", connString) Dim ds As New Data.DataSet() adapter.Fill(ds, "Products") Return ds End Function

ShowTo write the code in C#

C# code. Paste OVER the existing WebMethod. Copy Code
private static string connString = "Provider=Microsoft.Jet.OLEDB.4.0;
Data Source = C:\\Users\\[User Name]\\Documents\\ComponentOne Samples\\ActiveReports Developer 7\\Data\\nwind.mdb"; [WebMethod(Description="Returns a DataSet containing all Products")] public Data.DataSet GetProduct() { Data.OleDb.OleDbDataAdapter adapter; Data.DataSet ds; adapter = new Data.OleDb.OleDbDataAdapter("select * from products", connString); ds = new Data.DataSet(); adapter.Fill(ds, "Products"); return ds; }

ShowTo test the Web Service

  1. Press F5 to run the project.
  2. If the Debugging Not Enabled dialog appears, select the option that enables debugging and click OK to continue.
  3. In the list of supported operations, click the GetProduct link. (The description string from the code above appears below the link.)
  4. Click the Invoke button to test the Web Service operation.
  5. If the test is successful, a valid XML schema of the Northwind products table displays in a new browser window.
  6. Copy the URL from the browser for use in the Web Reference of your DataSet Windows Application.

ShowTo publish the Web Service

  1. In the Solution Explorer, right-click the project name and select Publish.
  2. In the Publish Web window that appears, enter locahost in the Service URL field and "SiteName"/WebService in the Site/application field.
    Note: Get the SiteName from the Internet Information Services Manager.
  3. Select the Mark an IIS application on destination option and click the OK button.

ShowTo check the configuration in IIS

  1. Open Internet Information Services Manager.
  2. In the Internet Information Services Manager window that appears, expand the tree view in the left pane until you see the Web Service you had added in the steps above.
  3. Right-click the Web Service select Manage Application then Browse.
  4. In the browser that appears, go to the Address bar and add \Service1 to the url.

For information on consuming the DataSet Web Service in an ActiveReport, see DataSet Windows Application.

See Also

©2014. ComponentOne, a division of GrapeCity. All rights reserved.