.NET Framework Bookmark and Share   
 index > .NET Remoting and Runtime Serialization > SOAP serialization cause Dictionary<string, string> Property wrong?
 

SOAP serialization cause Dictionary<string, string> Property wrong?

I am using SOA architechture in my project.

In this i ampassing an object as a parameter for every web method call.

I do have many property in this object, using this i am passing all type of data.

Here in this classi need to have Dictionary property. It is giving the error message saying not able to Serialize.

Is there any way to serialize Dictionary?

Thennavan Ramalingam

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnexxml/html/xml01202003.asp

Q: Why can't I serialize hashtables?

A: The XmlSerializer cannot process classes implementing the IDictionary interface. This was partly due to schedule constraints and partly due to the fact that a hashtable does not have a counterpart in the XSD type system. The only solution is to implement a custom hashtable that does not implement the IDictionary interface.

Lucian Bargaoanu

I had a similar issue. I inherted from Dictionary and IXmlSerializable.

[Serializable]
public
class MyDictionary<T, V> : Dictionary<T, V>, IXmlSerializable
{
public MyDictionary()
{
}

void IXmlSerializable.WriteXml(XmlWriter w)
{
}

void IXmlSerializable.ReadXml(XmlReader r)
{
}

}

Once you run it through the serializer, the WriteXML and ReadXML will invoke and there you write your own xml to support your structure...

Ralph Krausse

www.consiliumsoft.com

Ralph Krausse

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnexxml/html/xml01202003.asp

Q: Why can't I serialize hashtables?

A: The XmlSerializer cannot process classes implementing the IDictionary interface. This was partly due to schedule constraints and partly due to the fact that a hashtable does not have a counterpart in the XSD type system. The only solution is to implement a custom hashtable that does not implement the IDictionary interface.

Lucian Bargaoanu

I had a similar issue. I inherted from Dictionary and IXmlSerializable.

[Serializable]
public
class MyDictionary<T, V> : Dictionary<T, V>, IXmlSerializable
{
public MyDictionary()
{
}

void IXmlSerializable.WriteXml(XmlWriter w)
{
}

void IXmlSerializable.ReadXml(XmlReader r)
{
}

}

Once you run it through the serializer, the WriteXML and ReadXML will invoke and there you write your own xml to support your structure...

Ralph Krausse

www.consiliumsoft.com

Ralph Krausse

You can use google to search for other answers

Custom Search

More Threads

• Remoting
• Has SOAP datetime locale processing changed from .Net 1.1 to 2.0?
• Identifying if a proxy was created
• Out of Memory issue in IIS based, statefull Remoting app
• Urgent - IIS 6.0 Hosting remote obj trouble
• Distributed app no longer works after upgrading from MSDE2000 to Server Express 2005
• Serialization in c#
• Non-serializable type in a remoting environment
• CLR 2.0 XmlSerialization Bug possible....
• Serializing Collection Trees