I am getting really tired of seeing web services (or RSS feeds, or .NET methods, or anything else) with large blocks of complex, structured data that is exposed as “String”.
You call the web service, you get back this big string, which you then load into an XMLDocument and off you go (or XPath Navigator, etc…) … but if they had just defined the real structure in the first place, I wouldn’t have to do anything… I’d have a nice “weather” structure or “employee” object inside an “employees” collection… now, I can certainly massage/convert/deserialize their XML (well, I know it is XML, their wsdl says “String”) into a nice object collection, but why should I have to!?! They went to all of the work to produce formatted, structured XML output, why type it is as String?
Ach, maybe I’m missing something here, but I’m starting to get grumpy. I remember trying to show off an easy web service connection when I was at a booth at a convention so I randomly picked a web service listed on xmethods.com, and I picked the wrong one… now, don’t get me wrong… it worked fine, but I had to parse XML to get the temperature which made my simple demo a little more complicated than I wanted!
What I wanted was;
Dim myTemp as GlobalWeather.TemperatureResponse = GlobalWeather.GetTemperature(“Redmond”,”United States”)
(note, don’t try that, it won’t work… I’m just dreaming…)
There are plenty of web services (on xmethods and elsewhere) that work the right way (in my mind at least), but I keep running into ones that don’t…. or .NET assemblies that accept a String as a parameter, that is actually a String containing an XML document… instead of a properly defined structure… even though the XML you pass in has to conform to a very exact specification… why would anyone do that? Well some people tell me it is for flexibility, but I doubt it often works out for them.
Note that some web services should be string in, string out… like this cool looking RTF To HTML service I saw on xmethods…