Hi All,
I have been recieving a null pointer exception (SOAP Exception) from a web service I am calling that returns a complete dataset. Here is the web service:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
namespace LookupAllProductData
{
[WebService(Namespace = "]
public class LoadAllProductData : System.Web.Services.WebService
{
[WebMethod]
public DataSet Products()
{
SmartMartSystem.SmartMart A = new SmartMartSystem.SmartMart();
DataSet productsDataSet = new DataSet();
productsDataSet = A.lookupAllProducts();
productsDataSet = relateDataTables(productsDataSet);
return productsDataSet;
}
private DataSet relateDataTables(DataSet ds)
{
if (ds.Tables.Count < 1)
{
throw new Exception("Fxxx");
}
else
{
ds.Relations.Add("FamiliesToDepartments",
ds.Tables["Families"].Columns["FamilyId"],
ds.Tables["Departments"].Columns["FamilyId"], true);
ds.Relations["FamiliesToDepartments"].Nested = true;
ds.Relations.Add("DepartmentsToCategories",
ds.Tables["Departments"].Columns["DepartmentId"],
ds.Tables["Categories"].Columns["DepartmentId"], true);
ds.Relations["DepartmentsToCategories"].Nested = true;
ds.Relations.Add("CategoriesToSubCategories",
ds.Tables["Categories"].Columns["CategoryId"],
ds.Tables["Subcategories"].Columns["CategoryId"], true);
ds.Relations["CategoriesToSubcategories"].Nested = true;
ds.Relations.Add("SubcategoriesToProducts",
ds.Tables["Subcategories"].Columns["SubcategoryId"],
ds.Tables["Products"].Columns["SubcategoryId"], true);
ds.Relations["SubcategoriesToProducts"].Nested = true;
}
return ds;
}
}
}
I have been recieving a null pointer exception (SOAP Exception) from a web service I am calling that returns a complete dataset. Here is the web service:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
namespace LookupAllProductData
{
[WebService(Namespace = "]
public class LoadAllProductData : System.Web.Services.WebService
{
[WebMethod]
public DataSet Products()
{
SmartMartSystem.SmartMart A = new SmartMartSystem.SmartMart();
DataSet productsDataSet = new DataSet();
productsDataSet = A.lookupAllProducts();
productsDataSet = relateDataTables(productsDataSet);
return productsDataSet;
}
private DataSet relateDataTables(DataSet ds)
{
if (ds.Tables.Count < 1)
{
throw new Exception("Fxxx");
}
else
{
ds.Relations.Add("FamiliesToDepartments",
ds.Tables["Families"].Columns["FamilyId"],
ds.Tables["Departments"].Columns["FamilyId"], true);
ds.Relations["FamiliesToDepartments"].Nested = true;
ds.Relations.Add("DepartmentsToCategories",
ds.Tables["Departments"].Columns["DepartmentId"],
ds.Tables["Categories"].Columns["DepartmentId"], true);
ds.Relations["DepartmentsToCategories"].Nested = true;
ds.Relations.Add("CategoriesToSubCategories",
ds.Tables["Categories"].Columns["CategoryId"],
ds.Tables["Subcategories"].Columns["CategoryId"], true);
ds.Relations["CategoriesToSubcategories"].Nested = true;
ds.Relations.Add("SubcategoriesToProducts",
ds.Tables["Subcategories"].Columns["SubcategoryId"],
ds.Tables["Products"].Columns["SubcategoryId"], true);
ds.Relations["SubcategoriesToProducts"].Nested = true;
}
return ds;
}
}
}