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:
- Creating an ASP.NET Web Service project
- Adding code to create the Web method
- Testing the Web service
- Publishing the Web service
- Creating a virtual directory in IIS
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). |
To create an ASP.NET Web Service project
- From the File menu, select New Project.
- In the New Project dialog that appears, select ASP.NET Web Service Application.
- Change the name of the project.
- Click OK to open the new project in Visual Studio.
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.
To 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; |
C# code. Paste OVER the existing WebMethod. | Copy Code |
---|---|
private static string connString = "Provider=Microsoft.Jet.OLEDB.4.0; |
- Press F5 to run the project.
- If the Debugging Not Enabled dialog appears, select the option that enables debugging and click OK to continue.
- In the list of supported operations, click the GetProduct link. (The description string from the code above appears below the link.)
- Click the Invoke button to test the Web Service operation.
- If the test is successful, a valid XML schema of the Northwind products table displays in a new browser window.
- Copy the URL from the browser for use in the Web Reference of your DataSet Windows Application.
- In the Solution Explorer, right-click the project name and select Publish.
- 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. - Select the Mark an IIS application on destination option and click the OK button.
To check the configuration in IIS
- Open Internet Information Services Manager.
- 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.
- Right-click the Web Service select Manage Application then Browse.
- 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.