We don't use web services, we use iframes



  • One of my clients does a lot of shipping. Usually they have tens of thousands of parcels in transit. Here is how they keep track of those parcels:

    1. People who ship stuff from various warehouses throw packing slips in a box
    2. Every hour or so, a clerk faxes the packing slips to a third party system that stores them in PDF format in a S3 bucket on Amazon (1 fax number and 1 bucket per shipper)
    3. A WebJob on Azure runs every 10 minutes to download the pending PDFs, extract the tracking code and store it in a SQL Azure database
    4. A Visual FoxPro application (installed on a server with a console session active 24x7) executes a SSIS package to move the tracking codes from SQL Azure to a local CSV
    5. In a continuous loop, a second Visual FoxPro application (running on the same server, different GUI) uses WebBrowser controls to access the website of the shipper, submit the tracking code and parse the HTML to get the status. If the package has arrived, the tracking code is removed from the CSV, and the next SSIS package execution flags the record in SQL Azure

    The last step is done for all the tens of thousands of tracking codes, all day long. The Visual FoxPro application was a piece of shit when it was first created years ago and it did not age well. It is riddled with clever hacks to deal with javascript errors and other exceptions, and has a weird quasi-multithreaded design thanks to the 10 or 12 WebBrowser controls that work in parallel. The shipping companies complained because of the heavy web traffic but nothing was done to fix it, so they started to throttle the client's IP. Solution from the client? A kludgy round-robin utility that changes the routing table on the server every few minutes to switch between 3 NIC that are connected to different ISP... Apparently this was not a silver bullet because one of the programmers sent me an email a few weeks ago asking about Tor clients.

    So I was not surprised when the client contacted me to discuss the possibility of replacing the Visual FoxPro solution with a web application. At first I was under the impression that they were finally going to use the pretty robust web services provided by the shipping companies. But no. Their shiny new web application is trying to access the tracking websites client-side by using a mix of jQuery, iframes and setInterval... And strangely, in spite of unit tests passing with flying colors, the solution does not work in production, with various obvious problems (cross-origin, javascript framekillers, etc).

    The client did not call me in to tell them that their solution is a WTF. They called me to find a way to make this work. So I spent an hour with their "star programmer" and showed him how to use a reverse proxy. From the look of wonder in his eyes as he discovered the endless possibilities of ISAPI I know I opened a Pandora's box. I can't wait to see what kind of abomination I will discover at my next visit there.



  • Ah, that warm fuzzy feeling when you know you've just provided material for the next batch of TDWTF articles.



  • @martijntje said:

    Ah, that warm fuzzy feeling when you know you've just provided material for the next batch of TDWTF articles job security.



  • That must be at least near the top of the most WTFy things I've read here this whole year. My only reaction was, indeed, "WTF?"


Log in to reply