<search>
<result-count type="integer">774</result-count>
<results type="array">
<result>
<id type="integer">1850601</id>
<title>
Freda Cook demonstrating against the American Base at Woodbourne
</title>
<description>
Ans W (l.r., pencil) (verso, pencil) Freda Cook demonstrating against the American Base at Woodbourne 1971
</description>
[snip]
<date>1971-01-01T00:00:00.000Z</date></date>
<source-url>
http://api.digitalnz.org/records/1850601/source
</source-url>
[Snip]
<subject type="array">
<subject>Freda Cook</subject>
<subject>women</subject>
<subject>protesting</subject>
</subject>
[Snip]
</result>
[Snip rest]
I want to consume this XML within my ASP.Net site, picking out the data that I want (title, source-url, subject) and displaying this in a grid. How do I do this? I tried adding a service reference but every URL I tried failed in the Add Service Reference
dialog. I tried adding a Web Reference (once I'd found where Microsoft had hidden this in VS2010) but that also failed.
I assume that my solution will be to construct the URI, point an XMLReader at this, and then use XQuery within the XMLReader to extract the data that I want. Is this correct?
Robert Barne...
Member
451 Points
707 Posts
How do I consume a web service that returns XML, but does not (I think) return a schema
Dec 05, 2012 08:53 PM|LINK
If I construct a query then I can obtain XML from a web site. For example,
http://api.digitalnz.org/v3/records.xml?api_key=xxxxxxxxxxxxx&text=Freda+cook&fields=verbose
returns
<search>
<result-count type="integer">774</result-count>
<results type="array">
<result>
<id type="integer">1850601</id>
<title>
Freda Cook demonstrating against the American Base at Woodbourne
</title>
<description>
Ans W (l.r., pencil) (verso, pencil) Freda Cook demonstrating against the American Base at Woodbourne 1971
</description>
[snip]
<date>1971-01-01T00:00:00.000Z</date></date>
<source-url>
http://api.digitalnz.org/records/1850601/source
</source-url>
[Snip]
<subject type="array">
<subject>Freda Cook</subject>
<subject>women</subject>
<subject>protesting</subject>
</subject>
[Snip]
</result>
[Snip rest]
I want to consume this XML within my ASP.Net site, picking out the data that I want (title, source-url, subject) and displaying this in a grid. How do I do this? I tried adding a service reference but every URL I tried failed in the Add Service Reference dialog. I tried adding a Web Reference (once I'd found where Microsoft had hidden this in VS2010) but that also failed.
I assume that my solution will be to construct the URI, point an XMLReader at this, and then use XQuery within the XMLReader to extract the data that I want. Is this correct?
Thank you, Robert Barnes.
Robert Barne...
Member
451 Points
707 Posts
Re: How do I consume a web service that returns XML, but does not (I think) return a schema
Dec 06, 2012 03:23 AM|LINK
Sorted I think. I found this: -
http://csharp.net-tutorials.com/xml/introduction/
which so far has proven to be an excellent tutorial (except that I'd have preferred VB), and is answering all my questions.
Haixia Xie -...
Contributor
3022 Points
294 Posts
Microsoft
Re: How do I consume a web service that returns XML, but does not (I think) return a schema
Dec 07, 2012 06:41 AM|LINK
Glad to here that the issue had been resolved.
Best Regards.
Feedback to us
Develop and promote your apps in Windows Store