0

I was trying to see how I could get a timezone based on US zip code and found a post that suggested using a web service. I can see the methods when I view this in a browser. In VS, I started adding the web reference and used the link and clicked "Go". It finds the site and displays the available methods but won't allow me to add the reference and displays the following:

There was an error downloading 'http://www.webservicex.net/uszip.asmx/_vti_bin/ListData.svc/$metadata'. The request failed with the error message:

System.InvalidOperationException: _vti_bin/ListData.svc/$metadata Web Service method name is not valid. at System.Web.Services.Protocols.HttpSe

(this is all the error I can copy/paste). I cannot contact the web site for help, they only have mailing address. I was wondering if anyopostne knows how to resolve this.

UPDATE:

I tried both methods and keep getting:

System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 173.201.44.188:80

This is what I used, using both methods:

// Method 1
WebServiceNetX.USZip ZipCoding = new WebServiceNetX.USZip();
System.Xml.XmlNode ZipInfo = ZipCoding.GetInfoByZIP(sZip);
string sOutput = ZipInfo.OuterXml;

// Method 2
string url = @"http://www.webservicex.net/uszip.asmx/GetInfoByZIP?USZip=" + sZip;
System.Net.WebClient webClient = new System.Net.WebClient();
webClient.Encoding = Encoding.UTF8;
string result = webClient.DownloadString(url);
NoBullMan
  • 2,032
  • 5
  • 40
  • 93
  • Don't use a web reference. They are outdated. Though still created for particular reasons with some industries. Even in those industries, many people wrap soap services with their own restful services to be consumed internally. Use the restful approach. http://www.webservicex.net/uszip.asmx/GetInfoByZIP?USZip=73110 – Suamere Jan 13 '16 at 14:48
  • have you tried http://www.webservicex.net/uszip.asmx?wsdl address? – daryal Jan 13 '16 at 14:57
  • Thank you Suamere; I am not familiar with restful services but it seems it is the proper way of doing things and I have to learn and use it. For short term solution, daryal's solution worked. – NoBullMan Jan 13 '16 at 16:48
  • Thank you daryal. Adding ?wsdl fixed it. Add your response and I will mark it as answer. – NoBullMan Jan 13 '16 at 16:48

1 Answers1

0

You just run your Reporting Services Configuration Manager and connect it. Then refresh your Add web reference window.It will connect.

k3ka
  • 111
  • 1
  • 5