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

"Encoding: object has no 'SessionId' property" on "commandCryptic" #16

Closed
furdarius opened this issue Sep 11, 2016 · 4 comments
Closed
Labels

Comments

@furdarius
Copy link

furdarius commented Sep 11, 2016

Output of php -v:

PHP 7.0.10 (cli) (built: Aug 31 2016 00:26:56) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.10, Copyright (c) 1999-2016, by Zend Technologies

Output of cat /etc/*release*:

PRETTY_NAME="Debian GNU/Linux 8 (jessie)"
NAME="Debian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=debian
HOME_URL="http://www.debian.org/"
SUPPORT_URL="http://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Environment details:

Docker container (Dockerfile)

composer.json

{
    "require": {
        "amabnl/amadeus-ws-client": "dev-develop",
        "symfony/var-dumper": "^3.1"
    }
}

index.php

<?php

require 'vendor/autoload.php';

use Amadeus\Client;
use Amadeus\Client\Params;
use Amadeus\Client\Params\AuthParams;
use Amadeus\Client\RequestOptions\CommandCrypticOptions;
use Amadeus\Client\Result;

$authParams = new AuthParams(
    [
        'officeId'       => 'OFFICE_HERE', //The Amadeus Office Id you want to sign in to - must be open on your WSAP.
        'userId'         => 'USER_ID_HERE', //Also known as 'Originator' for Soap Header 1 & 2 WSDL's
        'passwordData'   => 'PASSWORD_HERE', // **base 64 encoded** password
        'passwordLength' => N,
        'dutyCode'       => 'SU',
        'organizationId' => 'NMC-RUSSIA',
    ]
);

$params = new Params(
    [
        'sessionHandlerParams' => [
            'soapHeaderVersion' => Client::HEADER_V2,
            //Points to the location of the WSDL file for your WSAP. Make sure the associated XSD's are also available.
            'wsdl'              => __DIR__ . '/WSDL_FOLDER/WSDL_NAME.wsdl',
            'logger'            => new Psr\Log\NullLogger()
        ],
        'authParams'           => $authParams,
        'requestCreatorParams' => [
            'receivedFrom' => 'ws client test project' // The "Received From" string that will be visible in PNR History
        ],
    ]
);

$client = new Client($params);

$authResult = $client->securityAuthenticate();

if ($authResult->status === Result::STATUS_OK) {


    $opt = new CommandCrypticOptions(
        [
            'entry' => 'DAC LON'
        ]
    );

    $crypticResponse = $client->commandCryptic($opt);

    dump($crypticResponse);
}

Steps to reproduce the issue:

  1. composer install
  2. php index.php

Results i have received:

Amadeus\Client\Result {#16
  +status: "FATAL"
  +messages: array:1 [
    0 => Amadeus\Client\Result\NotOk {#13
      +code: "SOAP-ERROR: Encoding: object has no 'SessionId' property"
      +text: null
      +level: null
    }
  ]
  +response: null
  +responseXml: null
}
@DerMika
Copy link
Collaborator

DerMika commented Sep 11, 2016

Hi, This is indeed a bug in the Soap Header 2 implementation. Luckily, i've just received a pull request to fix this bug in #15 which I've merged a few minutes ago on the develop branch.

Can you please run composer update and let me know if the problem is fixed now?

@furdarius
Copy link
Author

furdarius commented Sep 11, 2016

Hah, we are in one team with @smgladkovskiy but I didn't know that he was trying to fix it 😄

So, current response:

Amadeus\Client\Result {#28
  +status: "UNKNOWN"
  +messages: array:1 [
    0 => Amadeus\Client\Result\NotOk {#21
      +code: 0
      +text: "Response handling not supported for cryptic entries"
      +level: null
    }
  ]
  +response: {#15
    +"longTextString": {#25
      +"textStringDetails": """
        /$DAC LON                                                         \n
        A:APT B:BUS C:CITY G:GRD H:HELI O:OFF-PT R:RAIL S:ASSOC TOWN    \n
        CITY :                                                          \n
          LON C  LONDON                  /GB:UNITED KINGDOM             \n
        AIRPORT-HELIPORT :                                              \n
          BQH A  BIGGIN HILL             /GB      -  0K                 \n
          LGW A  GATWICK                 /GB      -  0K                 \n
          LHR A  HEATHROW                /GB      -  0K                 \n
          LCY A  LONDON CITY APT         /GB      -  0K                 \n
          LTN A  LUTON                   /GB      -  0K                 \n
          SEN A  SOUTHEND                /GB      -  0K                 \n
          STN A  STANSTED                /GB      -  0K                 \n
        RAIL-BUS STATION :                                              \n
          XQE R  EBBSFLEET INTL RAIL ST  /GB      -  0K                 \n
          QQU R  EUSTON RAILWAY STN      /GB      -  0K                 \n
          QQK R  KINGS CROSS RAIL STN    /GB      -  0K                 \n
          ZLS R  LIVERPOOL STREET        /GB      -  0K                 \n
          QQP R  PADDINGTON RAILWAY STN  /GB      -  0K                 \n
          QQS R  ST PANCRAS INTL RAILST  /GB      -  0K                 \n
          XOF R  STRATFORD INTL RAIL ST  /GB      -  0K                 \n
          ZEP R  VICTORIA RAILWAY STN    /GB      -  0K                 \n
          QQW R  WATERLOO RAILWAY STN    /GB      -  0K                 \n

        """
    }
  }
  +responseXml: """
    <Command_CrypticReply xmlns="http://xml.amadeus.com/HSFRES_07_3_1A"><longTextString><textStringDetails>/$DAC LON                                                         \n
    A:APT B:BUS C:CITY G:GRD H:HELI O:OFF-PT R:RAIL S:ASSOC TOWN    \n
    CITY :                                                          \n
      LON C  LONDON                  /GB:UNITED KINGDOM             \n
    AIRPORT-HELIPORT :                                              \n
      BQH A  BIGGIN HILL             /GB      -  0K                 \n
      LGW A  GATWICK                 /GB      -  0K                 \n
      LHR A  HEATHROW                /GB      -  0K                 \n
      LCY A  LONDON CITY APT         /GB      -  0K                 \n
      LTN A  LUTON                   /GB      -  0K                 \n
      SEN A  SOUTHEND                /GB      -  0K                 \n
      STN A  STANSTED                /GB      -  0K                 \n
    RAIL-BUS STATION :                                              \n
      XQE R  EBBSFLEET INTL RAIL ST  /GB      -  0K                 \n
      QQU R  EUSTON RAILWAY STN      /GB      -  0K                 \n
      QQK R  KINGS CROSS RAIL STN    /GB      -  0K                 \n
      ZLS R  LIVERPOOL STREET        /GB      -  0K                 \n
      QQP R  PADDINGTON RAILWAY STN  /GB      -  0K                 \n
      QQS R  ST PANCRAS INTL RAILST  /GB      -  0K                 \n
      XOF R  STRATFORD INTL RAIL ST  /GB      -  0K                 \n
      ZEP R  VICTORIA RAILWAY STN    /GB      -  0K                 \n
      QQW R  WATERLOO RAILWAY STN    /GB      -  0K                 \n
     </textStringDetails></longTextString></Command_CrypticReply>
    """
}

@DerMika
Copy link
Collaborator

DerMika commented Sep 11, 2016

Yes, that is normal behaviour.

The library does not check the response of a Command_Cryptic entry for errors, because it's just impossible to do that. If you use Command_Cryptic, you have to check for errors in your own application.

@furdarius
Copy link
Author

Thank you, for fast reply!

@DerMika DerMika added the bug label Sep 12, 2016
atomy pushed a commit to mlamm/amadeus-ws-client that referenced this issue Nov 26, 2018
…AN-468-service.amadeus-search-add-validating to master

* commit '02b3a7af4fa52b8fdaa3e00397cb921a9f84bd2d':
  VAN-468 service.amadeus / search / add validating carrier to output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants