Initially I thought this may be due to Firewall and have to open up port for that web application but the windows firewall was completely turned off (Not a good way of doing that, you should always open port instead of turning off the firewall). So the next thing I did is tried to access the web request URL from my browser for my surprise the URL worked perfectly fine and returned XML data.
For one instance I was thinking this might be something related to web.config settings for sharepoint web application. So went through various settings of web.Config file. Made the proxy settings entry in the System.Net Section of the web.config file and it worked like charm. Given below are the entires that i made in web.config file.
<system.net> <defaultProxy useDefaultCredentials="true"> <proxy usesystemdefault="False" proxyaddress="ServerName:portNo" bypassonlocal="False" /> </defaultProxy> </system.net>I was little bit confused at that instance because I had also specified proxy server settings in IE it didn’t work. Will look out for the correct reason why sharepoint was throwing this exception even after the proxy settings had been made in the browser and will update the post accordingly as of now it solved my issue and thought of posting it here.