Try adding an XmlInclude attribute to your method:
[WebMethod]
[XmlInclude(typeof(Product))]
Public double CalculateTotal(IProduct product, int Quantity)
{
return product.Price * Quantity;
}
Edit
Just incase you are getting confused with my use of the class "Product". Replace this class with whatever class in your assembly that implements IProduct e.g.
[Serializable]
public class Product : IProduct
{
public Product(string name, double price)
{
this.Name = name;
this.Price = price;
}
public string Name { get; private set; }
public double Price { get; private set; }
}
public interface IProduct
{
string Name { get; }
double Price { get; }
}
....
[Web Method]
[XmlInclude(typeof(Product))]
Public double CalculateTotal(IProduct product, int quantity)
{
return product.Price * quantity;
}
Basically when you pass an interface into a webservice it cannot find any schema for it, hence if you use XmlInclude attribute and pass in the concrete class it will be able to recognise the type.