[iRail] XML interface news

Pieter Colpaert pieter.colpaert at gmail.com
Wed Aug 11 18:24:54 UTC 2010


Evening,

To get information from that, we need to perform POST requests in
XML-format. The XML scheme of this XML you can find over here:

http://demo.hafas.de/hafas-res/sbb/xml/47r/hafasXMLInterface.xsd

So to get the ID's of the stations, we will first have to do a LocValReq
(Location Value Request). As everyone nowadays works on a unix system
(such as GNU/Linux), and if you have curl installed, we can easily try
to perform POST requests and see what comes out.

To get the ID's of a station, for instance Harelbeke:

curl -d '<?xml version="1.0 encoding="iso-8859-1"?>
<ReqC ver="1.1" prod="irail" lang="EN">
<LocValReq id="START" maxNr="1">
<ReqLoc match="Harelbeke" type="ST"/>
</LocValReq>
</ReqC>' http://hari.b-rail.be/Hafas/bin/extxml.exe

The response is something like this:

<?xml version="1.0" encoding="iso-8859-1"?>
<ResC ver="1.1" prod="5.26.B-RAIL.4.7-R4.5 [Sep 18 2009]" lang="EN">
 <LocValRes flag="FINAL" id="START">
  <Station name="Harelbeke" score="1416" externalId="008896115#80"
externalStationNr="008896115" type="WGS84" x="3314008" y="50855860"/>
 </LocValRes>
</ResC>

we get a score: this is an internal system of HAFAS to choose which
station should be returned (for instance, for GENT, we can return Sint
Pieters or Dampoort, so if you put in: GENT ST, it will return the
correct station since this one got a higher score)

we get an external Id, and external Station NR. That's nice, because we
can use this Station NR in other calls.

As you can see, we are also provided with GPS coordinates (x & y)

We can get other calls easily by studying the XML Scheme and testing
using curl. Afterwards we'll implement it in PHP.

Since we discovered this, we will do a rewrite of the API, in an Object
oriented system, and we will, if tests are successful, use the API's
code for the mobile irail.be mainsite as well.

Yours sincerely,
Pieter Colpaert


On Wed, 2010-08-11 at 19:06 +0200, Yeri Tiete wrote:
> Evening,
> 
> I have been in contact with someone that prefers to remain anonymous that has (limited) access to the NMBS (= Belgian Railway company) infrastructure.
> 
> First of all, the XML interface:
> 
> => http://hari.b-rail.be/Hafas/bin/extxml.exe
> 
> This interface is used internally and no other application uses this (and it's not known to anyone).
> There is no documentation about how this interface actually works (but Pieter has been playing with it) and thus he couldn't really help me further.
> 
> What I heard is that:
> => All trains and stations are actually numbers. 
> Say Antwerp Central station is for example 3949 (example!). So without an index there is no point even trying. And he couldn't find any index. So we're kind of stuck on that. 
> 
> He also would rather not send us the request example, because we can't really use it, and it might endanger him (open data, yay) as it would be obvious the leak is from the inside. 
> 
> He thinks scraping the HTML site is the way to go, or to get in touch with the NMBS.
> 
> Now, the NMBS has two departments that could help us:
> - National
> - International
> 
> He told me "National" is very strict, closed minded and we'll likely waste time on that, however, "International" is a lot opener (and shares info with other (rail) companies, including Google, for free). As he said, he doesn't get Google gets all info while something like iRail is being stopped.
> 
> As for the NMBS itself, it pays about 1500 euro per week to HaCon, the Hafas developer. HaCon updates all information for all train companies (in Europe), and generates time tables and lists once a week on some Unix server. So queries are actually not real time queries over multiple countries, but there's a list of everything pre-generated or something. So keep in mind HaCon apparently does own all the data and the NMBS is paying a fee to use the data (and probably a fee to use the software as well). 
> 
> What I'd suggest, is actually just knock on the NMBS' door, and go for a chat. I'll mail them this weekend. 
> 
> As for the Trac website (http://project.irail.be), I hope to have it fully functional by tonight. 
> 
> --
> Kind regards,
> Yeri Tiete
> yeri at tiete.be
> www.yeri.be
> +32 474/61.01.39
> 
> _______________________________________________
> iRail mailing list
> iRail at list.irail.be
> http://lists.rootspirit.com/mailman/listinfo/irail





More information about the iRail mailing list