Tropical Storm Tammy and the Zen of XmlCGI
My apologies for the overly done title. I didn’t know what to write and figured I’d just throw something out.
The hiking trip up Mount Washington planned for tomorrow has been postponed due to the weather, to whit, tropical storm Tammy. To say that I’m disappointed is an understatement. I had planned a trip of about 12 people and the weather just killed it. We’re going to try for next weekend, but the heated summit house will be closed for the winter season after Friday. C’est la vie.
After tinkering around with cgi.rb and reading the module’s source code, I discovered two things: it’s more powerful than I thought and I can’t use it for my XmlCGI interface. I actually got it to work with reading the CGI environment, but it reads the posted data and parses key=value data on stdin. I’m sending XML docs up via stdin, which cgi.rb then throws away.
So, I removed cgi.rb from the interface code and read the environment variables and the XML docs myself. After a few minutes of tweaking, I was able to get a RandomService.GetDiceRoll service request completed successfully.
There’s more to do, of course. The code does not recover from or report errors well. The Javascript XML response reader is tailored for the GetDiceRoll service only. I need to write a more generic parsing/extraction routine. Still, it’s a good start.