I’ve spent most of this weekend trying to build a simple JADE agent that will invoke a web service and return the results. I finally succeeded this morning, after a fashion. And it was not pretty.
I began trying a simple stock quote service, as I thought this would be useful and easy to incorporate into several demonstration workflows. I was able to find some public services available, so I set to work. I decided to use WSDL2Java utility to generate an interface I could easily call. The utility worked simply enough, although the code it generates is less than intuitive. Searching through several forums and tutorials weren’t much help; its interface is apparently sufficiently quirky that Axis2 didn’t much like it. Most other stock quote services are subscription-only, and I’m not going to be using this enough to make that worth my while.
So I decided to switch to a weather service; that’s always a good standby for a workflow. and the National Oceanic and Atmospheric Administration (NOAA) has a publicly available weather service I for a class project several years ago. It’s the National Digital Forecast Database (NDFD), and it makes all manner of weather information available.
After 8 or 10 different attempts to generate code from the WSDL, using both the Axis2 utility, the MyEclipse utility of the same name, and a couple of others, I found myself in the same state as I was with the stock quote service. The one major difference is that there is some chatter on various web sites and forums discussing the NDFD service, and apparently it’s not very well-behaved when code is generated from it. The general opinion of the user community seems to be that it’s a poorly designed service; I’m not enough of a programmer to offer a meaningful opinion.
I did finally get the NDFD service to work. It’s not pretty, but it works. I’m manually generating the SOAP request, building the message, and submitting it to the service. And as painful as that sounds, it’s no worse than dealing with the mess that is Axis2. I’m sure the authors mean well, but they seem focused on service providers and not consumers. Surely there must be a more straightforward way to write code for invoking a web service. It’s no wonder web service adoption has been much less rapid than originally anticipated.