473,408 Members | 2,813 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

WCF cannot deserialise nested arrays

Hi,

I have a WCF service contract which has message containing a List<MyType>
data member where MyType consists of a string Key and object Value.

As expected this gets exposed as a MyType[] array in the service reference.

In the client, I dynamically add Key/Value entries in the list.

This works fine as long as I use simple types in the client, but I need to
add a nested array into this list. That is, I need an element in the list
which is itself a MyType[] array.

When I send a message with a nested array, the server simply 'ignores' the
message. I know that the message arrives as I've got an
IDispatchMessageInspector class which logs everything that's received.

Is there a way for me to acheive this, without going down the manually
deserializing route?

Many thanks,

Barney.

Jul 8 '08 #1
1 5305
I have found the solution: you need to assign the
[KnownType(typeof(List<MyType>))] attribute to the message class.

"BarneyLight" wrote:
Hi,

I have a WCF service contract which has message containing a List<MyType>
data member where MyType consists of a string Key and object Value.

As expected this gets exposed as a MyType[] array in the service reference.

In the client, I dynamically add Key/Value entries in the list.

This works fine as long as I use simple types in the client, but I need to
add a nested array into this list. That is, I need an element in the list
which is itself a MyType[] array.

When I send a message with a nested array, the server simply 'ignores' the
message. I know that the message arrives as I've got an
IDispatchMessageInspector class which logs everything that's received.

Is there a way for me to acheive this, without going down the manually
deserializing route?

Many thanks,

Barney.
Jul 8 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Matthew Barnes | last post by:
I was wondering if there would be any interest in extending the struct.unpack format notation to be able to express groups of data with parenthesis. For example: >>> data =...
5
by: naturalborncyborg | last post by:
Hi, I'm using nested lists as arrays and having some problems with that approach. In my puzzle class there is a swapelement method which doesn't work out. Any help and comments on the code will be...
5
by: TheKeith | last post by:
I can't figure out why this doesn't work: --------------------------------------------- greeting = new Array(); greeting = "hey"; greeting = "bye"; trace(greeting + greeting);
1
by: elixxir | last post by:
Hiho, I'm trying to deserialize the following XML feed from the weather channel but I'm having an issue with the nested arrays. I got as far as getting the 'day' into arrays but I can't get the...
1
by: Philip K | last post by:
I was trying to use an XML file to save some program settings. But cannot serialise the settings object if it contains a Font object (even though Font is maked in the MS documentation. Dies in...
9
by: Bill Grigg | last post by:
All, Can anyone supply an example or reference to an example of using reflection to determine the data types and array lengths contained in a nested stucture in C#? Actually, it is a structure...
2
by: bill | last post by:
The IMAP_headers function returns an associative array. for example: $head = imap_header($in, ($index+1)); echo " <br />header:subject:" . $head->subject; works fine, but $head->from returns...
8
by: Sheldon | last post by:
Hi, Can anyone help with this problem with setting up nested structures and initializing them for use. I have created several structs and placed them in a super struct that I will then pass to...
3
by: Robert Mark Bram | last post by:
Hi all, I have some code to iterate through nested associative arrays. Can anyone please tell me what I am doing wrong? :) var dealers = new Array(); var dealer1 = new Array(); dealer1 =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.