Compare commits

..

No commits in common. "807c0b5a9b289537d08473239a4e59529a08f806" and "bac8e503637ae8f39fd8db9eafbdbcdb326e21f4" have entirely different histories.

4 changed files with 26 additions and 48 deletions

View File

@ -1,6 +1,6 @@
<?php
include("./php/LDBWS.php");
include("./php/OpenLDBWS.php");
include("/srv/keys/athena/apiKeys.php");
$OpenLDBWS = new Ldb($ldbKey,$trace=true);
$response = $OpenLDBWS->GetArrivalDepartureBoard(10,BRI);
echo $response;
$OpenLDBWS = new OpenLDBWS($ldbKey);
$response = $OpenLDBWS->GetArrDepBoardWithDetails(10,BRI,getNonPassengerServices="TRUE");
echo $response

View File

@ -1,41 +0,0 @@
<?php
require('/srv/keys/athena/apiKeys.php');
$wsdl = 'http://lite.realtime.nationalrail.co.uk/OpenLDBWS/wsdl.aspx';
$trace = true;
$exceptions = true;
$soapOptions = array("trace"=>$trace,"soap_version"=>SOAP_1_2,"features"=>SOAP_SINGLE_ELEMENT_ARRAYS);
$client = new SoapClient($wsdl, $soapOptions);
### BELOW THIS LINE NEEDS ADJUSTING TO NEW ENVIRONMENT -- USE SOAP FLATPAK TO FIND THE CURRENT URL FOR THE HEADER TYPE
## THE ACCESSTOKEN Var needs changinh to match what is in apiKeys.php
$soapVar = new SoapVar(array("ns2:TokenValue"=>$accessToken),SOAP_ENC_OBJECT);
$soapHeader = new SoapHeader("http://thalesgroup.com/RTTI/2010-11-01/ldb/commontypes","AccessToken",$soapVar,FALSE);
$client->__setSoapHeaders($soapHeader);
### This is the function to call the API:
### ACCESSTOKEN VAR ALSO NEEDS CHANGING HERE
function call($method,$params)
{
try
{
$response = $client->$method($params);
}
catch(SoapFault $soapFault)
{
if ($this->trace)
{
$traceOutput["soapFaultMessage"] = $soapFault->getMessage();
$traceOutput["soapClientRequest"] = str_replace($accessToken,"",$client->__getLastRequest());
$traceOutput["soapClientResponse"] = $client->__getLastResponse();
print_r($traceOutput);
}
}
return (isset($response)?$response:FALSE);
}

View File

@ -37,8 +37,11 @@
if ($this->trace)
{
$traceOutput["soapFaultMessage"] = $soapFault->getMessage();
$traceOutput["soapClientRequest"] = str_replace($this->accessToken,"",$this->soapClient->__getLastRequest());
$traceOutput["soapClientResponse"] = $this->soapClient->__getLastResponse();
print_r($traceOutput);
}
}

View File

@ -2,10 +2,26 @@
class OpenLDBSVWS
{
private $accessToken;
private $trace;
$wsdl = 'http://lite.realtime.nationalrail.co.uk/OpenLDBWS/wsdl.aspx';
function __construct($accessToken,$trace=TRUE)
private $trace;
private $wsdl = '<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:sv="http://thalesgroup.com/RTTI/2017-10-01/ldbsv/"
targetNamespace="http://thalesgroup.com/RTTI/2017-10-01/ldbsv/">
<wsdl:import
namespace="http://thalesgroup.com/RTTI/2017-10-01/ldbsv/"
location="http://lite.realtime.nationalrail.co.uk/OpenLDBSVWS/rtti_2017-10-01_ldbsv.wsdl"/>
<wsdl:service name="ldbsv">
<wsdl:port name="LDBSVServiceSoap12" binding="sv:LDBSVServiceSoap12">
<soap12:address location="http://lite.realtime.nationalrail.co.uk/OpenLDBSVWS/ldbsv12.asmx"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>';
function __construct($accessToken,$trace=FALSE)
{
$this->accessToken = $accessToken;