Skip to content

Commit

Permalink
Implemented support for multiple WSDL's: fixes #5. Still to-do: suppo…
Browse files Browse the repository at this point in the history
…rt extraction of WSDL messages when the message version contains a dot instead of an underscore.
  • Loading branch information
DerMika committed Sep 13, 2016
1 parent 0efd33e commit ddc0535
Show file tree
Hide file tree
Showing 18 changed files with 581 additions and 88 deletions.
11 changes: 9 additions & 2 deletions src/Amadeus/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ class Client
*/
protected $authParams;

/**
* @var string
*/
protected $lastMessage;

/**
* Set the session as stateful (true) or stateless (false)
*
Expand All @@ -130,7 +135,7 @@ public function isStateful()
*/
public function getLastRequest()
{
return $this->sessionHandler->getLastRequest();
return $this->sessionHandler->getLastRequest($this->lastMessage);
}

/**
Expand All @@ -140,7 +145,7 @@ public function getLastRequest()
*/
public function getLastResponse()
{
return $this->sessionHandler->getLastResponse();
return $this->sessionHandler->getLastResponse($this->lastMessage);
}

/**
Expand Down Expand Up @@ -678,6 +683,8 @@ protected function callMessage($messageName, $options, $messageOptions, $endSess
{
$messageOptions = $this->makeMessageOptions($messageOptions, $endSession);

$this->lastMessage = $messageName;

$sendResult = $this->sessionHandler->sendMessage(
$messageName,
$this->requestCreator->createRequest(
Expand Down
27 changes: 24 additions & 3 deletions src/Amadeus/Client/Params/SessionHandlerParams.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@ class SessionHandlerParams
/**
* Full file & path to the WSDL file to be used
*
* @var string
* @var string[]
*/
public $wsdl;
public $wsdl = [];

/**
* Which Soap Header version to be used
*
* @var string
*/
public $soapHeaderVersion = Client::HEADER_V4;
Expand Down Expand Up @@ -85,6 +86,13 @@ class SessionHandlerParams
*/
public $overrideSoapClient;

/**
* Override SoapClient WSDL name
*
* @var string
*/
public $overrideSoapClientWsdlName;

/**
* @param array $params
*/
Expand Down Expand Up @@ -119,12 +127,22 @@ protected function loadFromArray(array $params) {
/**
* Load WSDL from config
*
* Either a single WSDL location as string or a list of WSDL locations as array.
*
* @param array $params
* @return void
*/
protected function loadWsdl($params)
{
$this->wsdl = (isset($params['wsdl'])) ? $params['wsdl'] : null;
if (isset($params['wsdl'])) {
if (is_string($params['wsdl'])) {
$this->wsdl = [
$params['wsdl']
];
} elseif (is_array($params['wsdl'])) {
$this->wsdl = $params['wsdl'];
}
}
}

/**
Expand Down Expand Up @@ -180,6 +198,9 @@ protected function loadOverrideSoapClient($params)
if (isset($params['overrideSoapClient']) && $params['overrideSoapClient'] instanceof \SoapClient) {
$this->overrideSoapClient = $params['overrideSoapClient'];
}
if (isset($params['overrideSoapClientWsdlName'])) {
$this->overrideSoapClientWsdlName = $params['overrideSoapClientWsdlName'];
}
}

/**
Expand Down
Loading

0 comments on commit ddc0535

Please sign in to comment.