Help with deriving DataContract from Plain Old Xml Service
-
Hi all, having a bit of trouble with setting up a WCF client to consume a POX service (Truvevo video) The service returns an XML doc like this:
<Response>
<VideoSet>
<totalResultsAvailable>
integer value
</totalResultsAvailable>
<totalResultsReturned>
integer value
</totalResultsReturned>
<firstResultPosition>
integer value
</firstResultPosition>
<Video>
Nested XML elements
</Video>
<Video>
Nested XML elements
</Video>
<Video>
Nested XML elements
</Video>
<VideoSet>
</Response>In order to consume this service, I set up a WCF client that has this
[DataContract(Namespace = "http://xml.searchvideo.com")]
public class Response
{
///
/// Within the response we find the VideoSet tag, which
/// contains an array of Videos.//\[DataMember(Name = "VideoSet")\] //public Video\[\] TheVideoSet; \[DataMember(Name = "VideoSet")\] public VideoSet TheVideoSet; }
[DataContract(Namespace = "http://xml.searchvideo.com")]
public class VideoSet
{
[DataMember(Name = "totalResultsAvailable")]
public int TotalResultsAvailable;\[DataMember(Name="totalResultsReturned")\] public int TotalResultsReturned; \[DataMember(Name="firstResultPosition")\] public int FirstResultPositon; \[DataMember(Name="Video")\] public Video\[\] TheVideos }
If I run this code, I have values assigned for the three integer types, but the array is null. If I change the code in the Response class and simply add the Videoset DataMember attribute directly to the array of Video objects (these work), the array is populated, but obviously I don't get the results info. Anyone have any ideas?
"You're very clever, young man, very clever," said the old lady. "But it's turtles all the way down!"