2016-06-01 1 views
0

Salut je reçois cette erreurcode crs non valide fourni

'invalid crs code supllied' 

je suis en utilisant le code suivant pour accéder Départ en direct Boards Web Service (LDBWS/OpenLDBWS) comme mentionné here

var soap = require('soap'); 
    var url = 'https://lite.realtime.nationalrail.co.uk/OpenLDBWS/wsdl.aspx?ver=2016-02-16'; 
    var soapHeader = '<AccessToken><TokenValue>********token********</TokenValue></AccessToken>' 
    var args = { 
    numRows: 10, 
    crs: 'LST', 
    filterCrs:'', 
    filterType:'', 
    timeOffset:'', 
    timeWindow:'' 
}; 

    soap.createClient(url, function(err, client) { 
     client.addSoapHeader(soapHeader); 
    return client.GetArrivalDepartureBoard(args, function(err, result) { 
     return console.log(JSON.stringify(result)); 
    }); 
    }); 

Répondre

0

Il semble que le paramètre 'optionnel' filterCrs n'est pas si optionnel.

demande SOAP:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://thalesgroup.com/RTTI/2013-11-28/Token/types" xmlns:ldb="http://thalesgroup.com/RTTI/2016-02-16/ldb/"> 
    <soapenv:Header> 
     <typ:AccessToken> 
     <typ:TokenValue><!-- token --></typ:TokenValue> 
     </typ:AccessToken> 
    </soapenv:Header> 
    <soapenv:Body> 
     <ldb:GetDepartureBoardRequest> 
     <ldb:numRows>10</ldb:numRows> 
     <ldb:crs>WBY</ldb:crs> 
     <!--Optional:--> 
     <ldb:filterCrs>WAT</ldb:filterCrs> 
     <!--Optional:--> 
     <ldb:filterType>to</ldb:filterType> 
     <!--Optional:--> 
     <ldb:timeOffset>0</ldb:timeOffset> 
     <!--Optional:--> 
     <ldb:timeWindow>120</ldb:timeWindow> 
     </ldb:GetDepartureBoardRequest> 
    </soapenv:Body> 
</soapenv:Envelope> 

Réponse SOAP:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
    <soap:Body> 
     <GetDepartureBoardResponse xmlns="http://thalesgroup.com/RTTI/2016-02-16/ldb/"> 
     <GetStationBoardResult xmlns:lt3="http://thalesgroup.com/RTTI/2015-05-14/ldb/types" xmlns:lt5="http://thalesgroup.com/RTTI/2016-02-16/ldb/types" xmlns:lt4="http://thalesgroup.com/RTTI/2015-11-27/ldb/types" xmlns:lt="http://thalesgroup.com/RTTI/2012-01-13/ldb/types" xmlns:lt2="http://thalesgroup.com/RTTI/2014-02-20/ldb/types"> 
      <lt4:generatedAt>2016-08-03T09:02:33.8595652+01:00</lt4:generatedAt> 
      <lt4:locationName>West Byfleet</lt4:locationName> 
      <lt4:crs>WBY</lt4:crs> 
      <lt4:filterLocationName>London Waterloo</lt4:filterLocationName> 
      <lt4:filtercrs>WAT</lt4:filtercrs> 
      <lt4:platformAvailable>true</lt4:platformAvailable> 
      <lt5:trainServices> 
       <lt5:service> 
        <lt4:std>09:06</lt4:std> 
        <lt4:etd>On time</lt4:etd> 
        <lt4:operator>South West Trains</lt4:operator> 
        <lt4:operatorCode>SW</lt4:operatorCode> 
        <lt4:serviceType>train</lt4:serviceType> 
        <lt4:serviceID>w1psUjGu8tUpdYWgxHrUIw==</lt4:serviceID> 
        <lt5:rsid>SW752000</lt5:rsid> 
        <lt5:origin> 
        <lt4:location> 
         <lt4:locationName>Guildford</lt4:locationName> 
         <lt4:crs>GLD</lt4:crs> 
        </lt4:location> 
        </lt5:origin> 
        <lt5:destination> 
        <lt4:location> 
         <lt4:locationName>London Waterloo</lt4:locationName> 
         <lt4:crs>WAT</lt4:crs> 
        </lt4:location> 
        </lt5:destination> 
       </lt5:service> 
       <!-- snip --> 
      </lt5:trainServices> 
     </GetStationBoardResult> 
     </GetDepartureBoardResponse> 
    </soap:Body> 
</soap:Envelope>