Diego was excited. A vendor — one that, for the record, he had no choice but to work with — finally put together a web service. This was big news because it meant that Diego would no longer have to battle proprietary TCP protocols to get data extracts; he could use a simple, well-established protocol to download the data he needed.

When the vendor delivered the service documentation, however, Diego was a little disappointed. It was a little more... simple... than he had imagined.

string WebRequest(string parameter)

There was a single method, and it has a single string parameter and returned a single string. The "parameter" string was actually a multi-parameter and represented any number of parameters concatenated together. But instead of being comma-separated or otherwise delimited, it was a fixed width concatenation and depended on the operator. For example, if you wanted to search for records with "JACOB" in the last name and "NEW YORK" as the state, the method call would look something like this.

var result = WebRequest("SRCH JACOB NY ");

Put "JACOB" at position 24 instead of 25, and you might get records with first names ending with "J" and last names of "ACOB". All told, it was an even worse API than the proprietary TCP method, so Diego called the vendor to ask if they had a saner interface, perhaps one that communicated in XML.

"Actually we sure do," the developer on the other end enthusiastically replied, "if the first character of the Web Request is an X, then the results will be returned in XML instead of the normal fixed-width format!"

Skeptical, Diego tried the "X" trick and, lo and behold, it returned XML.

<?xml version="1.0" encoding="iso-8859-1" ?> <result> <fields> <field>NAME</field> <field>LAST NAME</field> <field>MOTHER MAIDEN NAME</field> <field>BIRTHDATE</field> ... </fields> <data> <row> <value>MARLENE</value> <value>RUTH</value> <value>DE MARCO</value> <value>1973-02-24 00:00:00</value> ... </row> </data> </result>

At least it was well formed XML.