Tag Archives: national rail enquiries

A useful Windows Phone 7 app in a couple of hours – Where’s my Train

I was interested to see that National Rail Enquiries has published a web service for its live departure boards. These give you reports on the next trains to depart from any given station, including information on late running.

Given that this is Windows Phone 7 week, I could not resist trying it out. I have a minimalist UI – you type in a station and hit Go. In version two you will just press Enter. It fetches the live train departures and displays them in a list. Version two might have a scrollbar too. Still, I’m pleased with the results, which could actually prove useful when I am running for a train.

image

Confession: it is currently hardcoded for just a few stations. That’s because you need to look up the station code in this table. I need to embed this database in my app somehow.

The coding is pretty simple though. It may help that the National Rail Enquiries web service is based on .NET, which is also why it does SOAP and WSDL, to the disappointment of those looking for REST. All the hard stuff is done by Add Service Reference in Visual Studio. The web service call is asynchronous, but there is a code completion wizard to add the necessary event handler.

Could be a money spinner if I can get it out quickly – but unfortunately the terms and conditions appear to prohibit its distribution:

This Web Site is for your personal and non-commercial use. You may not at any time modify, store, copy (including for example screen scraping), extract, reutilise, distribute, transmit, display, perform, reproduce, publish, license, create derivative works from, transfer, or sell, distribute or create any information, products or services obtained from, linked to or using this Web Site and any data therein or that may provide users with the ability to do the same.

These terms are bit puzzling, because on one interpretation they do not permit any use of the web service, even though it is stated that:

For the purposes of these Terms & Conditions the term Web Site also includes the web services, XML and any other data source supplying the Web Site.

Oh well. It still shows how quickly you can knock together a client for a web service and make something useful, although mine is really only a proof of concept. I reckon it would be almost as easy in Adobe AIR too – and then it would run on Android.

There is a National Rail Enquiries app for iPhone which costs $7.99 and likely uses the same web service.