E
erxuan
Hi,
I have a class as follows, and exposing this class via the
DataContract cause the service reference generation (automatic in
VS2008) on the client end to fail to the message listed below. Is
there a way to solve this issue?
Warning 1 Custom tool warning: Cannot
import wsdl
ortType
Detail: An exception was thrown while running a WSDL import extension:
System.ServiceModel.Description.DataContractSerializerMessageContractImporter
Error: Referenced type 'ClassLibrary.MyClasss2`1, ClassLibrary1,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' with data
contract name 'MyClass2Ofstring' in namespace 'http://
schemas.datacontract.org/2004/07/ClassLibrary1' cannot be used since
it does not match imported DataContract. Need to exclude this type
from referenced types.
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://
www.microsoft.com']/wsdl
ortType[@name='IMyService'] C:
\src\ServiceClient\Service References\MyService
\Reference.svcmap 1 1
ServiceClient
[DataContract]
public class MyClass1 //WebEntity
{
[DataMember]
private MyClass2<string> memberOfMyClass1;
…
}
[DataContract]
public class MyClass2 //EntityData
{
[DataMember]
private Dictionary<string, MyClass3<T>>
memberOfMyClass2;
}
[DataContract]
public class MyClass3<T> where T : IComparable //FieldData
{
[DataMember]
private List<T> memberOfMyClass3;
}
The service contract for the service:
[ServiceContract(Namespace = "http://www.microsoft.com")]
public interface IMyService
{
[OperationContract]
bool PostMyClass1(MyClass1 objOfMyClass1);
}
Thanks!
I have a class as follows, and exposing this class via the
DataContract cause the service reference generation (automatic in
VS2008) on the client end to fail to the message listed below. Is
there a way to solve this issue?
Warning 1 Custom tool warning: Cannot
import wsdl

Detail: An exception was thrown while running a WSDL import extension:
System.ServiceModel.Description.DataContractSerializerMessageContractImporter
Error: Referenced type 'ClassLibrary.MyClasss2`1, ClassLibrary1,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' with data
contract name 'MyClass2Ofstring' in namespace 'http://
schemas.datacontract.org/2004/07/ClassLibrary1' cannot be used since
it does not match imported DataContract. Need to exclude this type
from referenced types.
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://
www.microsoft.com']/wsdl

\src\ServiceClient\Service References\MyService
\Reference.svcmap 1 1
ServiceClient
[DataContract]
public class MyClass1 //WebEntity
{
[DataMember]
private MyClass2<string> memberOfMyClass1;
…
}
[DataContract]
public class MyClass2 //EntityData
{
[DataMember]
private Dictionary<string, MyClass3<T>>
memberOfMyClass2;
}
[DataContract]
public class MyClass3<T> where T : IComparable //FieldData
{
[DataMember]
private List<T> memberOfMyClass3;
}
The service contract for the service:
[ServiceContract(Namespace = "http://www.microsoft.com")]
public interface IMyService
{
[OperationContract]
bool PostMyClass1(MyClass1 objOfMyClass1);
}
Thanks!