National Rail Enquiries

LDB Web Service

This document describes how to interface to the Live Departure Boards (LDB) Web Service application to obtain the same live train running information presented on the LDB web pages in XML format. The service is implemented as a standard SOAP XML web service over an HTTP transport.

Use of this service requires a licence from National Rail Enquiries. Any use of the service without a licence is a breach of the Terms and Conditions. If you wish to apply for a licence please write to nrelicensing(at)atoc.org.

The current WSDL interface schema for the service can be found at "https://www.livedepartureboards.co.uk/LDBWS/wsdl.aspx?ver=2014-02-20". The additional WSDL and XML schema files referenced within this schema can also be downloaded from the same URL path, by replacing the wsdl.aspx part with the required file.

The WSDL for any supported previous versions of the service can be found at "https://www.livedepartureboards.co.uk/LDBWS/wsdl.aspx?ver=yyyy-mm-dd", where yyyy-mm-dd is replaced by the correct version number (obtained from the targetNamespace of the schema). Clients should always use the current version, but previous versions will continue to be maintained whenever possible. However, this cannot be guaranteed for all future changes, so developers should periodically check this page and the WSDL for new versions and migrate their clients to the latest version as soon as possible.

It is expected that a client will use an automatic proxy generation tool to produce the client proxy objects used to interface to the web service. Such a tool can be simply pointed at the URL given above, or the required WSDL & XSD files can be downloaded and used locally.

A client should always enable compression on the HTTP transport when making requests, whenever this is supported.

Note. For the avoidance of doubt, be aware that the web service end-point, as defined in the WSDL interface, expects a SOAP XML message and cannot be accessed from a Web browser!

Token

All licensed users will be issued with a Token code to access public web services. This token shall be passed as a SOAP Header value. The service will reject all requests with no Token or an incorrect Token code.

Web Service Operations

The LDB Web Service implements the following operations:

StationBoard GetDepartureBoard(numRows, crs, filterCrs, filterType, timeOffset, timeWindow)

StationBoard GetArrivalBoard(numRows, crs, filterCrs, filterType, timeOffset, timeWindow)

StationBoard GetArrivalDepartureBoard(numRows, crs, filterCrs, filterType, timeOffset, timeWindow)

ServiceDetails GetServiceDetails(serviceID)

The first three operations obtain a list of services (a station board) that are arriving/departing a particular station in (up to) the next 2 hours. The fourth operation obtains the details of an individual service that appears on a returned station board.

The station board operations are of 3 types: a board listing departures only, a board listing arrivals only and a board that lists combined arrivals and departures. A client should request the most specific board needed for their use. For example, if only departures from a station are required then the GetDepartureBoard operation should be used, rather than the GetArrivalDepartureBoard operation.

When requesting a station board, 2 mandatory and 4 optional parameters must be supplied. The two mandatory parameters are the maximum number of rows that should be returned in the station board, and the CRS code of the requested station. It is the caller's responsibility to maintain a list of valid CRS codes. A current list of CRS codes can be found at "http://nationalrail.co.uk/passenger_services/info_on_the_move/station_codes/".

The web service client should only request the minimum number of rows that are required for display of the required station board. For example, if the user interface only has space to display a list of 10 services, then numRows should always be set to 10. The Web Service will impose a maximum limit on the size of a station board, that may change dynamically according to the load on the service. At any time, the service may return less than the requested number of rows.

For each of the station boards, an optional "filter" may be applied. The filter allows the station board to be restricted by services that are going either to or from another station. The filterCrs parameter identifies which station the returned station board is filtered by. If this parameter is not supplied then the returned board will be un-filtered. If the parameter is present then the filterType parameter determines if the board is filtered by services either "from" or "to" the filterCrs location. The default value of the filterType parameter is "to".

Each station board first three methods also have two optional integer paratmeters. The timeOffset parameter containing the offset-times in minutes for defining the service (arrival/departure) staring times filter. If the parameter is not supplied then the offsetTime default value is 0. Only client with "NegativeTimeOffset" permission may have the negative time-offset. The timeWindow parameter containing value from 1 to 120 minutes which are the service time window filter. The parameter defautl value is 120 minutes (2 hours from starting time fileter). If the parameter is not suplied or the value is greater than 120 minutes then default value will be used. If the parameter value is a negative integer then a Soap exception will be thrwon and return an error code to the client. If the supllied parameters are outside the permitted time range, an Soap exception will be thrwon and return to the client an error message with a valid permitted time range.

The GetServiceDetails operation takes a single serviceID parameter. The value of this parameter is obtained from one of the services on a returned station board. The parameter identifies an individual service, relative to the station board from which it was obtained. Service details are only available while the service appears on the station board from which it was obtained. This is normally for two minutes after it is expected to have departed, or after a terminal arrival. If a request is made for a service that is no longer available then a null value is returned.

If an error occurs during execution of an operation (including detection of invalid parameter values, or the unavailability of the underlying LDB service), it will be communicated back to the client by means of a SOAP Fault. This will usually be translated by the user's proxy generation tools to an exception in the generated language code.

Data Interpretation

Each of the station board operations returns a StationBoard object. This object contains the following members:

StationBoard object members
Object Member Name Object Member Description
generatedAt The time at which the station board was generated.
locationName The name of the location that the station board is for.
crs The CRS code of the location that the station board is for.
filterLocationName If a filter was requested, the location name of the filter location.
filtercrs If a filter was requested, the CRS code of the filter location.
filterType If a filter was requested, the type of filter.
nrccMessages An optional list of textual messages that should be displayed with the station board. The message may include embedded and xml encoded HTML-like hyperlinks and paragraphs. The messages are typically used to display important disruption information that applies to the location that the station board was for. Any embedded <p> tags are used to force a new-line in the output. Embedded <a> tags allow links to external web pages that may provide more information. Output channels that do not support HTML should strip out the <a> tags and just leave the enclosed text.
platformAvailable An optional value that indicates if platform information is available. If this value is present with the value "true" then platform information will be returned in the service lists. If this value is not present, or has the value "false", then the platform "heading" should be suppressed in the user interface for this station board.
areServicesAvailable An optional value that indicates if services are currently available for this station board. If this value is present with the value "false" then no services will be returned in the service lists. This value may be set, for example, if access to a station has been closed to the public at short notice, even though the scheduled services are still running. It would be usual in such cases for one of the nrccMessages to describe why the list of services has been suppressed.
trainServices
busServices
ferryServices
Each of these lists contains a ServiceItem object for each service of the relevant type that is to appear on the station board. Each or all of these lists may contain zero items, or may not be present at all.

The ServiceItem objects in the station board service lists have the following members:

ServiceItem object members
Object Member Name Object Member Description
origin A list of ServiceLocation objects giving original origins of this service. Note that a service may have more than one original origin, if the service comprises of multiple trains that join at a previous location in the schedule. Original Origins will only be available for Arrival and Arrival & Departure station boards.
destination A list of ServiceLocation objects giving original destinations of this service. Note that a service may have more than one original destination, if the service comprises of multiple trains that divide at a subsequent location in the schedule. Original Destinations will only be available for Departure and Arrival & Departure station boards.
currentOrigins An optional list of ServiceLocation objects giving live/current origins of this service which is not starting at original cancelled origins. Note that a service may have more than one live origin. if the service comprises of multiple trains that join at a previous location in the schedule. Live Origins will only be available for Arrival and Arrival & Departure station boards.
currentDestinations An optional list of ServiceLocation objects giving live/current destinations of this service which is not ending at original cancelled destinations. Note that a service may have more than one live destination, if the service comprises of multiple trains that divide at a subsequent location in the schedule. Live Destinations will only be available for Departure and Arrival & Departure station boards.
sta An optional Scheduled Time of Arrival of the service at the station board location. Arrival times will only be available for Arrival and Arrival & Departure station boards but may also not be present at locations that are not scheduled to arrive at the location (e.g. the origin).
eta An optional Estimated Time of Arrival of the service at the station board location. Arrival times will only be available for Arrival and Arrival & Departure station boards and only where an sta time is present.
std An optional Scheduled Time of Departure of the service at the station board location. Departure times will only be available for Departure and Arrival & Departure station boards but may also not be present at locations that are not scheduled to depart at the location (e.g. the destination).
etd An optional Estimated Time of Departure of the service at the station board location. Departure times will only be available for Departure and Arrival & Departure station boards and only where an std time is present.
platform An optional platform number for the service at this location. This will only be present where available and where the station board platformAvailable value is "true".
operator The name of the Train Operating Company that operates the service.
operatorCode The code of the Train Operating Company that operates the service.
isCircularRoute If this value is present and has the value "true" then the service is operating on a circular route through the network and will call again at this location later on its journey. The user interface should indicate this fact to the user, to help them choose the correct service from a set of similar alternatives.
serviceID The unique service identifier of this service relative to the station board on which it is displayed. This value can be passed to GetServiceDetails to obtain the full details of the individual service.
adhocAlerts A list of Adhoc Alers related to this locationa for this service. This list contains an object called AdhocAlertTextType which contains a string to show the Adhoc Alert Text for the locaiton.

The ServiceLocation object has the following members:

ServiceLocation object members
Object Member Name Object Member Description
locationName The name of the location.
crs The CRS code of this location. A CRS code of ??? indicates an error situation where no crs code is known for this location.
via An optional via text that should be displayed after the location, to indicate further information about an ambiguous route. Note that vias are only present for ServiceLocation objects that appear in destination lists.
futureChangeTo A text string contianing service type (Bus/Ferry/Train) to which will be changed in the future.
assocIsCancelled This origin or destination can no longer be reached because the association has been cancelled.

The GetServiceDetails operation returns a ServiceDetails object. This object contains the following members:

ServiceDetails object members
Object Member Name Object Member Description
generatedAt The time at which the service details were generated.
serviceType The type of service (train, bus, ferry) that these details represent. Note that real-time information (e.g. eta, etd, ata, atd, isCancelled, etc.) is only available and present for train services.
locationName The display name of the departure board location that these service details were accessed from.
crs The CRS code of the departure board location that these service details were accessed from.
operator The display name of the Train Operating Company that operates this service.
operatorCode The code of the Train Operating Company that operates this service.
isCancelled Indicates that the service is cancelled at this location.
disruptionReason A disruption reason for this service. If the service is cancelled, this will be a cancellation reason. If the service is running late at this location, this will be a late-running reason.
overdueMessage If an expected movement report has been missed, this will contain a message describing the missed movement.
platform The platform number that the service is expected to use at this location, if known and available.
sta The scheduled time of arrival of this service at this location. If no sta is present then this is the origin of this service or it does not set down passengers at this location.
eta The estimated time of arrival. Will only be present if sta is also present and ata is not present.
ata The actual time of arrival. Will only be present if sta is also present and eta is not present.
std The scheduled time of departure of this service at this location. If no std is present then this is the destination of this service or it does not pick up passengers at this location.
etd The estimated time of departure. Will only be present if std is also present and atd is not present.
atd The actual time of departure. Will only be present if std is also present and etd is not present.
adhocAlerts A list of active Adhoc Alert texts for to this location. This list contains an object called AdhocAlertTextType which contains a string to show the Adhoc Alert Text for the locaiton.
previousCallingPoints A list of lists of CallingPoint objects representing the previous calling points in the journey. A separate calling point list will be present for each origin of the service, relative to the current location.
subsequentCallingPoints A list of lists of CallingPoint objects representing the subsequent calling points in the journey. A separate calling point list will be present for each destination of the service, relative to the current location.

The CallingPoint objects in the service details calling point lists have the following members:

CallingPoint object members
Object Member Name Object Member Description
locationName The display name of this location.
crs The CRS code of this location. A CRS code of ??? indicates an error situation where no crs code is known for this location.
st The scheduled time of the service at this location. The time will be either an arrival or departure time, depending on whether it is in the subsequent or previous calling point list.
et The estimated time of the service at this location. The time will be either an arrival or departure time, depending on whether it is in the subsequent or previous calling point list. Will only be present if an actual time (at) is not present.
at The actual time of the service at this location. The time will be either an arrival or departure time, depending on whether it is in the subsequent or previous calling point list. Will only be present if an estimated time (et) is not present.
adhocAlerts A list of active Adhoc Alert texts for to this location. This list contains an object called AdhocAlertTextType which contains a string to show the Adhoc Alert Text for the locaiton.

The calling point lists in the ServiceDetails object need further explaination. It is possible for certain trains to be formed from multiple separate trains, or to split into multiple trains, at certain points in their schedule. In such circumstances, some trains may have multiple origins or destinations and therefore, there may be mutiple lists of calling points in the previousCallingPoints or subsequentCallingPoints properties. The first list of calling points will be for the "through" train and will hold all of the locations from the origin (for previousCallingPoints) or to the destination (for subsequentCallingPoints). The remaining lists will hold the locations of joining/splitting trains from/to their respective origins/destinations. The point at which the association is made is determined by examining the last location in the previousCallingPoints list, or the first location in the subsequentCallingPoints list. To get a better idea of how this works, look at a Train Details page on the LDB web site for a train that has an association. A good station to look for such trains would be Gatwick Airport [GTW].

In the objects detailed above, certain properties were specified to return time values. These values will either return absolute times, formatted as a HH:MM string, or a text string such as (but not limited to) "On time", "No report" or "Cancelled". These times should be output in the user interface exactly as supplied. In some cases, the time value may have an asterisk ("*") appended to indicate that the value is "uncertain".