473,396 Members | 1,780 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,396 software developers and data experts.

deserializing arrays of complex types

I am able to deserialize an array using XMLSerializer but the size of an
array is 0.The problem seems to be because of unqualified element name but I
am not very sure.

Here is what I did:

I get the following xml from the server

================================================== =

<fault xsi:type="FdkException" xmlns="http://xmlns.oracle.com/content/ws"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<exceptionEntries soapenc:arrayType="FdkExceptionEntry[1]"
xsi:type="soapenc:Array"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<exceptionEntries xsi:type="FdkExceptionEntry">
<detailedErrorCode
xsi:type="xsd:string">ORACLE.FDK.ServerError</detailedErrorCode>
<serverStackTraceId
xsi:type="xsd:string">22-1132729995032</serverStackTraceId>
</exceptionEntries>
</exceptionEntries>
</fault>

================================================== =

I want to deserialize the complex type FdkException which has an array of
FdkExceptionEntry.Definition of the the types are follows

[System.Serializable]
[XmlRootAttribute("fault",
Namespace="http://xmlns.oracle.com/content/ws",IsNullable = false)]
[System.Xml.Serialization.XmlType("FdkException",
Namespace="http://xmlns.oracle.com/content/ws")]

public class FdkException
{
public FdkExceptionEntry[] exceptionEntries;

}
[System.Serializable]
[System.Xml.Serialization.SoapTypeAttribute("FdkExc eptionEntry",
"http://xmlns.oracle.com/content/ws")]
[System.Xml.Serialization.XmlType("FdkExceptionEntr y",
Namespace="http://xmlns.oracle.com/content/ws")]
public class FdkExceptionEntry
{
public string detailedErrorCode;

public string serverStackTraceId;
}

If I change the XML from the server to the following, array is deserialised
perfectly with length 1.

================================================== =

<fault xsi:type="FdkException" xmlns="http://xmlns.oracle.com/content/ws"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<exceptionEntries soapenc:arrayType="FdkExceptionEntry[1]"
xsi:type="soapenc:Array"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<FdkExceptionEntry>
<detailedErrorCode
xsi:type="xsd:string">ORACLE.FDK.ServerError</detailedErrorCode>
<serverStackTraceId
xsi:type="xsd:string">22-1132729995032</serverStackTraceId>
</FdkExceptionEntry>
</exceptionEntries>
</fault>

================================================== =
Client Code:

System.Xml.Serialization.XmlSerializer ser= new
System.Xml.Serialization.XmlSerializer(typeof(FdkE xception));
FdkException fault= (FdkException)
ser.Deserialize(new System.Xml.XmlTextReader(XMLStream));
XMLStream.Close();

--gaurav
Nov 26 '05 #1
1 4964
DC
The two XML snippets - the before and after - are exactly the same?

You said "If I change the XML to... <blah>... then it works."
But that <blah> is the same as the original XML.

Care to amend your post?

-D
D i n o . C h i e s a AT M i c r o s o f t . c o m

"GAURAV KRISHNA" <GA***********@discussions.microsoft.com> wrote in message
news:80**********************************@microsof t.com...
I am able to deserialize an array using XMLSerializer but the size of an
array is 0.The problem seems to be because of unqualified element name but
I
am not very sure.

Here is what I did:

I get the following xml from the server

================================================== =

<fault xsi:type="FdkException" xmlns="http://xmlns.oracle.com/content/ws"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<exceptionEntries soapenc:arrayType="FdkExceptionEntry[1]"
xsi:type="soapenc:Array"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<exceptionEntries xsi:type="FdkExceptionEntry">
<detailedErrorCode
xsi:type="xsd:string">ORACLE.FDK.ServerError</detailedErrorCode>
<serverStackTraceId
xsi:type="xsd:string">22-1132729995032</serverStackTraceId>
</exceptionEntries>
</exceptionEntries>
</fault>

================================================== =

I want to deserialize the complex type FdkException which has an array of
FdkExceptionEntry.Definition of the the types are follows

[System.Serializable]
[XmlRootAttribute("fault",
Namespace="http://xmlns.oracle.com/content/ws",IsNullable = false)]
[System.Xml.Serialization.XmlType("FdkException",
Namespace="http://xmlns.oracle.com/content/ws")]

public class FdkException
{
public FdkExceptionEntry[] exceptionEntries;

}
[System.Serializable]
[System.Xml.Serialization.SoapTypeAttribute("FdkExc eptionEntry",
"http://xmlns.oracle.com/content/ws")]
[System.Xml.Serialization.XmlType("FdkExceptionEntr y",
Namespace="http://xmlns.oracle.com/content/ws")]
public class FdkExceptionEntry
{
public string detailedErrorCode;

public string serverStackTraceId;
}

If I change the XML from the server to the following, array is
deserialised
perfectly with length 1.

================================================== =

<fault xsi:type="FdkException" xmlns="http://xmlns.oracle.com/content/ws"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<exceptionEntries soapenc:arrayType="FdkExceptionEntry[1]"
xsi:type="soapenc:Array"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<FdkExceptionEntry>
<detailedErrorCode
xsi:type="xsd:string">ORACLE.FDK.ServerError</detailedErrorCode>
<serverStackTraceId
xsi:type="xsd:string">22-1132729995032</serverStackTraceId>
</FdkExceptionEntry>
</exceptionEntries>
</fault>

================================================== =
Client Code:

System.Xml.Serialization.XmlSerializer ser= new
System.Xml.Serialization.XmlSerializer(typeof(FdkE xception));
FdkException fault= (FdkException)
ser.Deserialize(new System.Xml.XmlTextReader(XMLStream));
XMLStream.Close();

--gaurav

Nov 30 '05 #2

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

Similar topics

20
by: Pavel Stehule | last post by:
Hello, Is possible merge two arrays like array + array => array select array_append(array, array); ERROR: function array_append(integer, integer) does not exist
4
by: Wayne Wengert | last post by:
Using VB.NET I want to read in an XML file that has an array of objects and then step through the resulting array in code. I build a class to define the structure and I am running code to read in...
0
by: Casey | last post by:
So I'm using XmlSerializer to serialize out a wrapper object that contains an arbitrary number of other objects. The class definitions listed below are made to be very generic. Some of the...
2
by: Earl Teigrob | last post by:
I am saving and restoring value types such as Int32, DateTime and Boolean in strings. I was wondering if there is a mechanism build into .NET for serializing and deserializing these to string...
1
by: Kevin R | last post by:
Hi All, I have a binary file, the first few k of which contains some information which I need to stick in to an array of types,let's call them Wongas. Each Wonga is made up of two ulongs and a...
2
by: Chukkalove | last post by:
I'm sorry this message is so long. I have had to make some changes to an application written by a previous developer who used unmanaged serialization to store complex objects to file. The...
0
by: Sivajee Akula | last post by:
Hello All, I am trying to consume a .NET Service from Adobe LiveCycle Workflow. The service deals with complex objects. I am getting the following exception at the time of invocation of the...
1
by: =?Utf-8?B?SmVyZW15X0I=?= | last post by:
I am working on an order entry program and have a question related to deserializing nodes with nested elements. The purchase order contains multiple line items which I select using an...
0
by: theonlydavewilliams | last post by:
Hi there I'm hoping there's an easy answer to a (hopefully) not too long-winded issue... I'm building a C# web client using a proxy wsdl.exe'd from a wsdl file and six schemas, each in a different...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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.