Click here to Skip to main content
15,891,847 members
Articles / Web Development / ASP.NET

A reporting service using SOAP calls passing XML to a Data Extension

Rate me:
Please Sign up or sign in to vote.
4.00/5 (5 votes)
19 Oct 2005CPOL8 min read 85.4K   406   26  
Demostrates how to render a report by passing XML to a data extension via SOAP calls.
using System;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics;
using System.Web;
using System.Web.Services;
using System.Xml;
using System.Data;

namespace RSTestWS
{
	/// <summary>
	/// Summary description for BusinessData.
	/// </summary>
	public class BusinessData : System.Web.Services.WebService
	{
		public BusinessData()
		{
			//CODEGEN: This call is required by the ASP.NET Web Services Designer
			InitializeComponent();
		}

		#region Component Designer generated code
		
		//Required by the Web Services Designer 
		private IContainer components = null;
				
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if(disposing && components != null)
			{
				components.Dispose();
			}
			base.Dispose(disposing);		
		}
		
		#endregion

		// WEB SERVICE EXAMPLE
		// The HelloWorld() example service returns the string Hello World
		// To build, uncomment the following lines then save and build the project
		// To test this web service, press F5

		[WebMethod]
		public DataSet GetReportDataSet(string sXml)
		{
			// parse xml
			// call business component based on method defined in xml
			DataSet ds = null;
			try
			{
				string sWebMethod = string.Empty;

				XmlDocument doc = new XmlDocument();
				doc.LoadXml(sXml);

				sWebMethod = doc.SelectSingleNode("//WebMethod").InnerText;

				BusinessDataAccess DataAccess = new BusinessDataAccess();

				switch (sWebMethod)
				{
					case "GetCustomers":
						ds = DataAccess.GetCustomers(sXml);
						break;

					case "GetTerritorySales":
						ds = DataAccess.GetTerritorySales(sXml);
						break;

					case "GetSalesOrder":
						ds = DataAccess.GetSalesOrder(sXml);
						break;

					case "GetSalesOrderDetail":
						ds = DataAccess.GetSalesOrderDetail(sXml);
						break;
				}
			}
			catch
			{
			}
			return ds;
		}
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) LEN Associates Inc.
United States United States
Years of software consulting and software development using Microsoft development products such as Microsoft Content Management System, SQL Server Reporting Service, ASP.Net C# VB.Net, HTML and javascript web development, Visual Studio add-on development, C++ MFC/ATL and COM+ development, and ActiveX components.

Comments and Discussions