XML Serialization error when trying to return CSLA object from Web Service

XML Serialization error when trying to return CSLA object from Web Service

Old forum URL: forums.lhotka.net/forums/t/141.aspx


ltgrady posted on Thursday, May 18, 2006

We have an application running on the old CSLA, actually the first version, and we haven't ported it to the new CSLA yet.  However, we need to write some Web Services for it and would like to return our CSLA object as our output.

 

WHen I attempt to run my Web Service I get:

 

To be XML serializable, types which inherit from ICollection must have an implementation of Add(CSLA.BrokenRules+Rule) at all levels of their inheritance hierarchy. CSLA.BrokenRules+RulesCollection does not implement Add(CSLA.BrokenRules+Rule).

Here is my Web Service:

<%@ WebService Language="C#" CodeBehind="~/App_Code/ProductSearch.cs" Class="ProductSearch" %>

using System;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using OurNamespaceDotNet.Library;

[WebService(Namespace = "OurNamespaceDotNetWebServices")]

[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

public class ProductSearch : System.Web.Services.WebService
{
      
public ProductSearch()
   {
         
[WebMethod(Description = "Retrives the selected Products")]
         
public Products GetProducts(Guid BrandID)
         {
                  
Products prds = Products.GetProducts(BrandID);
                  
return prds;
         }
}

 

I have attached my collection Products.cs

I have also attached a stripped down version of my switchable object Product.cs (the whole object has about 100 properties to I stripped it down to just a few for the example).

 

Any ideas?

Copyright (c) Marimer LLC