?
Solved

Serializing Objects in Web Services

Posted on 2006-04-27
4
Medium Priority
?
223 Views
Last Modified: 2010-04-16
Hi,

I am currently experiencing difficulty when returned an arraylist of objects from a web service. I am calling the web service using the web browser, however the xml returned does not contain all the public properties of the objects.

I am returned an arraylist of Question objects, each with a number of public properties one of which is an arraylist of Selection objects. I thought that the web service would automatically serialize the public properties into XML etc. I've been reading up on XMLSerialization but cant seem to understand it all that well.

Any suggestions on returning the XML I want?

Thanks

Kev

0
Comment
Question by:fevster
  • 2
  • 2
4 Comments
 

Author Comment

by:fevster
ID: 16550887
I've basically added the XmlInclude attribute to allow the returning of the different objects and added the XmlElement attribute to the arraylist within the question object.

However the Xml being returned is

- <anyType xsi:type="CreditExpertQuestion">
  <Selections />
  <Selections />
  <Selections />
  </anyType>

It doensnt seem to be returning any of the public properties. Any ideas?

Thanks
0
 
LVL 11

Accepted Solution

by:
Agarici earned 500 total points
ID: 16550967
are your props in Selections read only? i mean, do theyhave both get and set implemented?
0
 

Author Comment

by:fevster
ID: 16550978
OMG. I didnt know that one. Just tried it out and it works. Any ideas why they wont output the properties if there readonly? Great answer thanks.
0
 
LVL 11

Expert Comment

by:Agarici
ID: 16550987
because it has to work both ways
i mean: the serialized data has to be deserialized
and to do that the serializer has to have a way to assign values to properties

hth,
A.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses
Course of the Month14 days, 9 hours left to enroll

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question