I am in a situation where I am trying to pass a CSLA object across a WCF wire. With ReadOnlyObjects I find the svcutil generates a client stub just fine. But when I use a regular BusinessBase class, I am being returned with an improper client stub and an error from svcutil of:
Attempting to download metadata from http://localhost:8001/WcfServer/ITestInfo' using WS-Metadata Exchange or DISCO.Error: Cannot import wsdl:portTypeDetail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporterError: ISerializable type with data contract name 'PropertyChangedEventHandler'in namespace 'http://schemas.datacontract.org/2004/07/System.ComponentModel' cannot be imported. The data contract namespace cannot be customized for ISerializable types and the generated namespace My.Test.Namespace' does not match the required CLR namespace 'System.ComponentModel'. Check if the required namespace has been mapped to a different data contract namespace and consider mapping it explicitly using the namespaces collection.XPath to Error Source: //wsdl:definitions[@targetNamespace='net.tcp://my.wcf.com/WcfServer']/wsdl:portType[@name=' ITestInfo ']
Has anyone experienced this error before? I am unsure of where to solve the issue with the PropertyChangedEventHandler.
This type of thing has been discussed numerous times on the forum. You can't pass CSLA objects using web services or vanilla WCF because the serializers those technologies use aren't capable of working against rich .NET types. They are designed to work with data transfer objects (DTOs).
Check out Chapter 11 in the book for a discussion around creating service-oriented interfaces over the top of CSLA business objects.
Copyright (c) Marimer LLC