0

I built a demo over the past few days importing data from the National Weather Service's web services, and today it's broken:

System.Xml.XmlException - {"'', hexadecimal value 0x1F, is an invalid character. Line 1, position 1."}

I'm importing the WSDL as a web reference and using the objects directly, not making the SOAP calls manually or loading an XML.

http://graphical.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl

http://graphical.weather.gov/xml/

Any ideas on how to fix this? here's some simplified code:

using gov.weather.graphical;
...
string sList = "30.267,-97.743 30.267,-97.743 32.9612,-96.8372 33.1097,-96.6695";       
ndfdXML service = new ndfdXML();
string sResult;
DateTime startDate = Convert.ToDateTime(DateTime.Now.ToShortDateString() + " 00:00:00 AM");
DateTime endDate = Convert.ToDateTime(startDate.ToShortDateString() + " 23:59:59 PM");

string sListCurrent = aList[x].ToString();
sResult = service.NDFDgenLatLonList(sList, productType.glance, startDate, endDate, unitType.e, wpt);
fizgig
  • 292
  • 2
  • 4
  • 22
  • Now 2 hours later I come back and it's working. odd. maybe they had issues on their end. I'd still like to handle this error more gracefully than skipping the import. – fizgig Jun 08 '12 at 15:30
  • The issue is indeed on their end. See this question http://stackoverflow.com/questions/6693153/what-is-character-0x1f Basically, they were inserting bad text into their XML response. (And, I would guess, they are using XML 1.0) – JDB Jun 08 '12 at 15:43
  • try{}catch{} might be of assistance with error handling. However, it might also be worth checking that the problem might not be due to the hex being provided in lower/upper case when it should be provided in upper/lower case - it's a simple problem but one that I've encountered a surprisingly large number of times. – GeorgePotter Jun 08 '12 at 15:45

0 Answers0