Hi
We are trying to download an XML document from the internet and are getting
the error:
The underlying connection was closed: Unable to connect to the remote
server.
We are not behind a proxy server and have no desktop firewall / antivirus
blocking the connection.
When i add a web reference to my project i get the error:
The document at the url
http://newsapi.bbc.co.uk/feeds/search/news+sport/tennis OR henman was not
recognized as a known document type.
The error message from each known type may help you fix the problem:
- Report from 'WSDL Document' is 'There is an error in XML document (3,
3).'.
- <rss xmlns=''> was not expected.
- Report from 'DISCO Document' is 'Discovery document at the URL
http://newsapi.bbc.co.uk/feeds/search/news+sport/tennis OR henman could not
be found.'.
- The document format is not recognized.
- Report from 'XML Schema' is 'Expected Schema root. Make sure that the root
element is <schema> and the namespace is 'http://www.w3.org/2001/XMLSchema'
for an XSD schema or 'urn:schemas-microsoft-com:xml-data' for an XDR schema.
An error occurred at , (3, 3).'.
I have tried many types of web request in .net and the same problem occurs,
my code is currently:
Private Sub getxm()
' Retrieve XML document
Dim reader As XmlTextReader = New
XmlTextReader("http://newsapi.bbc.co.uk/feeds/search/news+sport/tennis%20OR%20henman#")
' Skip non-significant whitespace
reader.WhitespaceHandling = WhitespaceHandling.Significant
' Read nodes one at a time
While reader.Read()
' Print out info on node
Console.WriteLine("{0}: {1}", reader.NodeType.ToString(), reader.Name)
End While
End Sub
And a sample of the XML is below:
<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet title="XSL_formatting" type="text/xsl" href="/nolsol.xsl"
?>
<rss version="2.0">
<channel>
<ttl>15</ttl>
<title>BBC News and Sport Search: tennis or henman</title>
<link>http://newsapi.bbc.co.uk/feeds/search/news+sport/tennis+or+henman</link>
<description>BBC News and Sport Search: tennis or henman</description>
<language>en-gb</language>
<lastBuildDate>Mon, 31 Dec 2007 17:24:12 GMT</lastBuildDate>
<item>
<title>One woman's mission of the heart</title>
<link>http://news.bbc.co.uk/go/rss/news/int/search/news%2Bsport/tennis+or+henman/-/2/hi/uk_news/7164808.stm</link>
<guid
isPermaLink="false">http://news.bbc.co.uk/2/hi/uk_news/7164808.stm</guid>
<pubDate>Sun, 30 Dec 2007 15:00:17 GMT</pubDate>
<description>The head of a cardiac awareness charity explains why it
advocates a screening policy for people from all backgrounds, not just
sport.</description>
</item>
<item>
<title>Masters Tennis photos</title>
<link>http://news.bbc.co.uk/go/rss/news/int/search/news%2Bsport/tennis+or+henman/-/sport2/hi/tennis/7128537.stm</link>
<guid
isPermaLink="false">http://news.bbc.co.uk/sport2/hi/tennis/7128537.stm</guid>
<pubDate>Sun, 09 Dec 2007 17:11:02 GMT</pubDate>
<description>Pictures of the Masters Tennis at the Royal Albert
Hall</description>
</item>
<item>
<title>Bogdanovic 'handed golden chance'</title>
<link>http://news.bbc.co.uk/go/rss/news/int/search/news%2Bsport/tennis+or+henman/-/sport2/hi/tennis/7128277.stm</link>
<guid
isPermaLink="false">http://news.bbc.co.uk/sport2/hi/tennis/7128277.stm</guid>
<pubDate>Wed, 05 Dec 2007 10:41:46 GMT</pubDate>
<description>Tim Henman urges Alex Bogdanovic to take full advantage
of Brad Gilbert's coaching.</description>
</item>
</channel>
</rss>