<?php
class LDBWS {
private $soapClient;
private static $URI = "https://lite.realtime.nationalrail.co.uk/OpenLDBWS/wsdl.aspx?ver=2016-02-16";
private static $NS = "http://thalesgroup.com/RTTI/2016-02-16/ldb/";
private static $TOKEN = "my-token-value";
private $header;
public function __construct(){
$params = array("trace" => true );
$this->soapClient = new SoapClient(self::$URI, $params);
$headerParams = array("tns:TokenValue" => self::$TOKEN);
$soapStruct = new SoapVar($headerParams, SOAP_ENC_OBJECT);
$this->header = new SoapHeader(self::$NS, "AccessToken", $soapStruct, false);
$this->soapClient->__setSoapHeaders($this->header);
}
public function getDepartureBoard($argsArray = array()){
return $this->soapClient->__call("GetDepartureBoard", $argsArray);
}
}
try{
$ldbws = new LDBWS();
$ldbws->getDepartureBoard(array("numRows" => "5", "crs" => "WAE"));
}catch(SoapFault $e){
echo "<pre>";
print_r($e);
echo "</pre>";
}
SoapFault Object
(
[message:protected] => Unauthorized
[string:Exception:private] =>
[code:protected] => 0
[file:protected] => D:\localServer\apache24\htdocs\www\soap.php
[line:protected] => 24
[trace:Exception:private] => Array
(
[0] => Array
(
[function] => __doRequest
[class] => SoapClient
[type] => ->
[args] => Array
(
[0] => my-token-value
[1] => https://lite.realtime.nationalrail.co.uk/OpenLDBWS/ldb9.asmx
[2] => http://thalesgroup.com/RTTI/2012-01-13/ldb/GetDepartureBoard
[3] => 1
[4] => 0
)
)
[1] => Array
(
[file] => D:\localServer\apache24\htdocs\www\soap.php
[line] => 24
[function] => __call
[class] => SoapClient
[type] => ->
[args] => Array
(
[0] => GetDepartureBoard
[1] => Array
(
[numRows] => 5
[crs] => WAE
)
)
)
[2] => Array
(
[file] => D:\localServer\apache24\htdocs\www\soap.php
[line] => 33
[function] => getDepartureBoard
[class] => LDBWS
[type] => ->
[args] => Array
(
[0] => Array
(
[numRows] => 5
[crs] => WAE
)
)
)
)
[previous:Exception:private] =>
[faultstring] => Unauthorized
[faultcode] => HTTP
)
Cheers,
Matt
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://thalesgroup.com/RTTI/2016-02-16/ldb/"xmlns:ns2="http://thalesgroup.com/RTTI/2016-02-16/ldb/myCustomNameSpace"><SOAP-ENV:Header><ns2:AccessToken><ns2:TokenValue>my-token-value</ns2:TokenValue></ns2:AccessToken></SOAP-ENV:Header><SOAP-ENV:Body><ns1:GetDepartureBoardRequest/><param1>WAE</param1></SOAP-ENV:Body></SOAP-ENV:Envelope>--
You received this message because you are subscribed to the Google Groups "A gathering place for the Open Rail Data community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openraildata-t...@googlegroups.com.
To post to this group, send email to openrail...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.