Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Air_MultiAvailability version 16+ #99

Closed
ghost opened this issue Oct 6, 2017 · 8 comments
Closed

Support for Air_MultiAvailability version 16+ #99

ghost opened this issue Oct 6, 2017 · 8 comments

Comments

@ghost
Copy link

ghost commented Oct 6, 2017

I am trying to implement Air_MultiAvailability method but I get a SOAP-ERROR

Here is my code

require 'vendor/autoload.php';

use Amadeus\Client;
use Amadeus\Client\Params;
use Amadeus\Client\Result;
use Amadeus\Client\RequestOptions\AirMultiAvailabilityOptions;
use Amadeus\Client\RequestOptions\Air\MultiAvailability\RequestOptions;
use Amadeus\Client\RequestOptions\Air\MultiAvailability\FrequentTraveller;


//Set up the client with necessary parameters:

$pass = base64_encode(**********);

$params = new Params([
    'authParams' => [
        'officeId' => '**********', //The Amadeus Office Id you want to sign in to - must be open on your WSAP.
        'userId' => '**********', //Also known as 'Originator' for Soap Header 1 & 2 WSDL's
        'passwordData' => $pass // **base 64 encoded** password
    ],
    'sessionHandlerParams' => [
        'soapHeaderVersion' => Client::HEADER_V4, //This is the default value, can be omitted.
        'wsdl' => '/var/www/etm/Amadeus/wsdl/1ASIWMTSNLC_PDT_20171002_143536.wsdl', //Points to the location of the WSDL file for your WSAP. Make sure the associated XSD's are also available.
        'stateful' => false, //Enable stateful messages by default - can be changed at will to switch between stateless & stateful.
        'logger' => new Psr\Log\NullLogger()
    ],
    'requestCreatorParams' => [
        'receivedFrom' => 'GoGo Travel' // The "Received From" string that will be visible in PNR History
    ]
]);

$client = new Client($params);

$opt = new AirMultiAvailabilityOptions([
    'actionCode' => AirMultiAvailabilityOptions::ACTION_AVAILABILITY,
    'requestOptions' => [
        new RequestOptions([
            'departureDate' => \DateTime::createFromFormat('Ymd-His', '20171025-000000', new \DateTimeZone('UTC')),
            'from' => 'IEV',
            'to' => 'MOW',
            'requestType' => RequestOptions::REQ_TYPE_NEUTRAL_ORDER
        ])
    ]
]);


$recommendations = $client->airMultiAvailability($opt);
// echo $availabilityResult->status;
if ($recommendations->status === Result::STATUS_OK) {
    // echo "Successfully retrieved PNR, no errors in PNR found!";
   header("Content-type: text/xml; charset=utf-8");
    echo '<?xml version="1.0" encoding="UTF-8"?>';
    

    echo $recommendations->responseXml;
}else{
    echo "<pre>";
    var_dump($recommendations);
        echo "</pre>";
}

And here is the error
object(Amadeus\Client\Result)#38 (4) { ["status"]=> string(5) "FATAL" ["messages"]=> array(1) { [0]=> object(Amadeus\Client\Result\NotOk)#39 (3) { ["code"]=> string(60) "SOAP-ERROR: Encoding: object has no 'typeOfRequest' property" ["text"]=> NULL ["level"]=> NULL } } ["response"]=> NULL ["responseXml"]=> NULL }

@DerMika
Copy link
Collaborator

DerMika commented Oct 6, 2017

Looks like (part of) the request object isn't being encoded properly.

Can you please tell me which version of Air_MultiAvailability you have in your WSDL?

Also it would help if you could add a logger to your testcode and paste the log request & response here (make sure any private information such as auth information is stripped). I want to see what the entire request XML looks like (again, minus SOAP headers).

@DerMika
Copy link
Collaborator

DerMika commented Oct 17, 2017

Any status update?

@ghost
Copy link
Author

ghost commented Oct 19, 2017

Version: Air_MultiAvailability_16_1_1A
$client->getLastRequest() and $client->getLastResponse() return NULL

@DerMika
Copy link
Collaborator

DerMika commented Oct 19, 2017

is 16.1 the only version of Air_MultiAvailability in your WSDL?

I need you to give the result of var_dump($messageBody) at the first line of Amadeus\Client\Session\Handler\Base::sendMessage() when you are making the Air_MultiAvailability call.

And also the result of var_dump($this->getActiveVersionFor($messageName)) at the same location in the code.

@DerMika
Copy link
Collaborator

DerMika commented Oct 19, 2017

Nevermind, I figured it out. There is a change in the structure in the Air_MultiAvailability between version 15 and 16. I'll have to adapt the library to support version 16+.

@DerMika DerMika changed the title Air_MultiAvailability FATAL Support for Air_MultiAvailability structure version 16+ Oct 19, 2017
@DerMika DerMika added this to the 1.5.0 milestone Oct 19, 2017
@DerMika DerMika changed the title Support for Air_MultiAvailability structure version 16+ Support for Air_MultiAvailability version 16+ Oct 20, 2017
@DerMika
Copy link
Collaborator

DerMika commented Nov 1, 2017

Hi, I've implemented a fix on the master branch to support Air_MultiAvailability messages version 16 and up.

You can test it by switching your composer.json to dev-master.

Can you please check if this message is now working for you? If so, I'll release this fix with the 1.5.0 release.

@ghost
Copy link
Author

ghost commented Nov 2, 2017

Hi!

Yeah, now it is working correctly.

Thank you!

@ghost ghost closed this as completed Nov 2, 2017
@DerMika
Copy link
Collaborator

DerMika commented Nov 5, 2017

Version 1.5.0 is released. You can now use Air_MultiAvailability version 16 and up if you do a composer upgrade to version 1.5.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant