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.

5 thoughts on “A useful Windows Phone 7 app in a couple of hours – Where’s my Train”

  1. There is a Windows vista / 7 desktop gadget built by conchango, along with one for outlook. Possibly they’ll be able to tell you more.

  2. Hi Tim,

    The actual National Rail Enquiries iPhone application uses a basic authentication “protected” version of their service which includes many other calls that aren’t provided from the open service.

    The terms and conditions are pretty stupid considering all this information is publicly available on their website anyway.

    I should get round to blogging about the iPhone/MonoTouch version which uses the same web service actually.

    Cheers,

    ChrisNTR

  3. Chris

    Good info, thanks. I’ve emailed to ask what the T&C for the web service really are.

    Tim

  4. Tim,

    From what I remember, there were a few iPhone applications either using their custom “iPhone” service or screen scraping information from the website. These (free) applications were pretty popular but got taken down around the time the “official” application got released (which was of course, paid for).

    Would be interested in seeing what they come back with.

    ChrisNTR

  5. I got a prompt reply and was told:

    The webservice can only be used under licence and there is usually a charge for use.

    You need to describe your app and intended usage to them and they will give you terms.

    Tim

Comments are closed.