mail-archives/monodroid/2011-December/007904.html

145 строки
5.3 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [mono-android] Can not send IDictionary to WCF
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:monodroid%40lists.ximian.com?Subject=%5Bmono-android%5D%20Can%20not%20send%20IDictionary%20to%20WCF&In-Reply-To=D7C394926CDE044A9287D0D6D87360B13920080EBB%40aumail01.PROJECTCENTRE.loc">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="007951.html">
<LINK REL="Next" HREF="007925.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[mono-android] Can not send IDictionary to WCF</H1>
<B>RScanlon</B>
<A HREF="mailto:monodroid%40lists.ximian.com?Subject=%5Bmono-android%5D%20Can%20not%20send%20IDictionary%20to%20WCF&In-Reply-To=D7C394926CDE044A9287D0D6D87360B13920080EBB%40aumail01.PROJECTCENTRE.loc"
TITLE="[mono-android] Can not send IDictionary to WCF">rscanlon at originhs.com
</A><BR>
<I>Fri Dec 16 15:21:26 EST 2011</I>
<P><UL>
<LI>Previous message: <A HREF="007951.html">[mono-android] MonoDroid 4.0.1, APP Crash when debugging
</A></li>
<LI>Next message: <A HREF="007925.html">[mono-android] Can not send IDictionary to WCF
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#7904">[ date ]</a>
<a href="thread.html#7904">[ thread ]</a>
<a href="subject.html#7904">[ subject ]</a>
<a href="author.html#7904">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>I too am having a very similar issue.
The only real difference is that we use actual Dictionaries instead of
IDictionary.
I believe the issue stems from having a custom or complex type as either the
key or value in your dictionary.
I have tested it sending a string for the key and an int for the value and
it works fine.
I have also used fiddler to examine the difference in the SOAP between the
XML that mono sends and the xml that .NET or Silverlight sends. What I have
found is that .NET and Silverlight appends what appears to be a seemingly
random set of characters onto the end of the type name. But in truth it must
not be random because through different projects and compiles the string
remains consistent. I have also noticed that it changes depending on what
namespace your custom class is in. So it must be some form of digest of a
namespace. Without this, the WCF server is unable to deserialize the
dictionary properly.
Below is an example of the dictionary in XML created by mono and then the
XML created by .NET.
This is in a namespace called Joe and is a dictionary keyed by string with a
value of type SimpleTest.
Mono:
&lt;d4p1:NewDict
xmlns:d5p1=&quot;<A HREF="http://schemas.microsoft.com/2003/10/Serialization/Arrays&quot;">http://schemas.microsoft.com/2003/10/Serialization/Arrays&quot;</A>&gt;
&lt;d5p1:KeyValueOfstringSimpleTest&gt;
&lt;d5p1:Key&gt;TestKey1&lt;/d5p1:Key&gt;
&lt;d5p1:Value&gt;
&lt;int1
xmlns=&quot;<A HREF="http://schemas.datacontract.org/2004/07/Origin.BLL.Joe&quot;">http://schemas.datacontract.org/2004/07/Origin.BLL.Joe&quot;</A>&gt;1&lt;/int1&gt;
&lt;string1
xmlns=&quot;<A HREF="http://schemas.datacontract.org/2004/07/Origin.BLL.Joe&quot;">http://schemas.datacontract.org/2004/07/Origin.BLL.Joe&quot;</A>&gt;Test1&lt;/string1
&lt;/d5p1:Value&gt;
&lt;/d5p1:KeyValueOfstringSimpleTest&gt;
&lt;/d4p1:NewDict&gt;
.NET
&lt;d4p1:NewDict
xmlns:d5p1=&quot;<A HREF="http://schemas.microsoft.com/2003/10/Serialization/Arrays&quot;">http://schemas.microsoft.com/2003/10/Serialization/Arrays&quot;</A>&gt;
&lt;d5p1:KeyValueOfstringSimpleTest3HyOSdeZ&gt;
&lt;d5p1:Key&gt;TestKey1&lt;/d5p1:Key&gt;
&lt;d5p1:Value
xmlns:d7p1=&quot;<A HREF="http://schemas.datacontract.org/2004/07/Origin.BLL.Joe&quot;">http://schemas.datacontract.org/2004/07/Origin.BLL.Joe&quot;</A>&gt;
&lt;d7p1:int1&gt;1&lt;/d7p1:int1&gt;
&lt;d7p1:string1&gt;Test1&lt;/d7p1:string1&gt;
&lt;/d5p1:Value&gt;
&lt;/d5p1:KeyValueOfstringSimpleTest3HyOSdeZ&gt;
&lt;/d4p1:NewDict&gt;
Notice how .NET appends &quot;3HyOSdeZ&quot; on the end of SimpleTest.
Where you able to come up with a solution to your issue?
--
View this message in context: <A HREF="http://mono-for-android.1047100.n5.nabble.com/Can-not-send-IDictionary-to-WCF-tp4908854p5081325.html">http://mono-for-android.1047100.n5.nabble.com/Can-not-send-IDictionary-to-WCF-tp4908854p5081325.html</A>
Sent from the Mono for Android mailing list archive at Nabble.com.
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="007951.html">[mono-android] MonoDroid 4.0.1, APP Crash when debugging
</A></li>
<LI>Next message: <A HREF="007925.html">[mono-android] Can not send IDictionary to WCF
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#7904">[ date ]</a>
<a href="thread.html#7904">[ thread ]</a>
<a href="subject.html#7904">[ subject ]</a>
<a href="author.html#7904">[ author ]</a>
</LI>
</UL>
<hr>
<a href="http://lists.ximian.com/mailman/listinfo/monodroid">More information about the Monodroid
mailing list</a><br>
</body></html>