المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Web Service Object References



C# Programming
12-18-2009, 08:20 PM
I am creating a web service that will be called from a console application. I am having trouble creating objects in the console application in order to pass them to the web service.

I have Classes in the Web Site project that are similar to the following:

public class Product
{
//other product details
}

public class SubProduct : Product
{
//subproduct details
public innerObject io;
}

public class innerObject
{
//object details
}


The web service contains a function:

[WebMethod]
public string LoadProduct(Product[] p)
{
//does stuff here
if (p is SubProduct)
{
//do stuff specific to subproduct objects.
}
}

I want the console application to create an array of products and pass it to the web service. Each product in the array could be of type Product or SubProduct. The problem I am encountering is that SubProducts and the innerObject types are not a recognized or accessible in the console application. It seems like all that is imported from the web reference to the web service are the objects types that are listed in the parameter list of the web service methods.

Does anyone know how I can make the SubProduct and innerObject classes accessible from the web service code?

thanks.