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

No active session #40

Closed
icaroce opened this issue Feb 14, 2017 · 6 comments
Closed

No active session #40

icaroce opened this issue Feb 14, 2017 · 6 comments

Comments

@icaroce
Copy link

icaroce commented Feb 14, 2017

Hello guys!

Could someone help me with this situation?

Its necessary another step to create session?

    $msgLog = new Logger('RequestResponseLogs');
    $msgLog->pushHandler(new StreamHandler('C:/requestresponse.log', Logger::INFO));

    $params = new Params([
        'sessionHandlerParams' => [
            'soapHeaderVersion' => Client::HEADER_V2,
            'wsdl' => 'C:\wsdl\AmadeusWebServices.wsdl', //Points to the location of the WSDL file for your WSAP. Make sure the associated XSD's are also available.
            'logger' => $msgLog,
            'authParams' => [
                'officeId' => 'xxxx', //The Amadeus Office Id you want to sign in to - must be open on your WSAP.
                'userId' => 'xx', //Also known as 'Originator' for Soap Header 1 & 2 WSDL's
                'passwordData' => base64_decode('xxxxxx'), // **base 64 encoded** password
                'passwordLength' => 8,
                'dutyCode' => 'xx',
                'organizationId' => 'xx',
        ]
    ],
    'requestCreatorParams' => [
        'receivedFrom' => 'my test project' // The "Received From" string that will be visible in PNR History
    ]
]);

   $client = new Client($params);
    dump($msgLog, $client->getSessionData());

    $pnrResult = $client->pnrRetrieve(
        new PnrRetrieveOptions(['recordLocator' => '3MHKL2'])
    );
InvalidSessionException in SoapHeader2.php line 68:
No active session
in SoapHeader2.php line 68
at SoapHeader2->prepareForNextMessage('PNR_Retrieve', array('endSession' => false)) in Base.php line 251
at Base->sendMessage('PNR_Retrieve', object(Retrieve), array('endSession' => false)) in Client.php line 912
at Client->callMessage('PNR_Retrieve', object(PnrRetrieveOptions), array('endSession' => false)) in Client.php line 258
@icaroce
Copy link
Author

icaroce commented Feb 15, 2017

I had forgotten the $client->securityAuthenticate()
But when I did the request is empty.

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://xml.amadeus.com/VLSSLQ_06_1_1A">
    <SOAP-ENV:Body>
        <ns1:Security_Authenticate>
            <ns1:userIdentifier>
                <ns1:originIdentification>
                    <ns1:sourceOffice/>
                </ns1:originIdentification>
                <ns1:originatorTypeCode/>
                <ns1:originator/>
            </ns1:userIdentifier>
            <ns1:dutyCode>
                <ns1:dutyCodeDetails>
                    <ns1:referenceQualifier>DUT</ns1:referenceQualifier>
                    <ns1:referenceIdentifier/>
                </ns1:dutyCodeDetails>
            </ns1:dutyCode>
            <ns1:systemDetails>
                <ns1:organizationDetails>
                    <ns1:organizationId/>
                </ns1:organizationDetails>
            </ns1:systemDetails>
            <ns1:passwordInfo>
                <ns1:dataLength/>
                <ns1:dataType>E</ns1:dataType>
                <ns1:binaryData/>
            </ns1:passwordInfo>
        </ns1:Security_Authenticate>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Header xmlns="http://webservices.amadeus.com/definitions">
        <SessionId>015S216GJ3|1</SessionId>
    </soap:Header>
    <soap:Body>
        <soap:Fault xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
            <faultcode>soap:Client</faultcode>
            <faultstring>18|Presentation|Fusion DSC found an exception !\n
                \tMissing Mandatory tag :\n
                \tExpected element: userIdentifier\n
                \tCurrent position in buffer: &lt;ns1:dutyCode&gt;&lt;ns1:dutyCodeDet\n
                \tLast 15 characters before error: y_Authenticate&gt;
            </faultstring>
            <faultactor>SI:APA</faultactor>
        </soap:Fault>
    </soap:Body>
</soap:Envelope>

@DerMika
Copy link
Collaborator

DerMika commented Feb 15, 2017

Hi,

The thing that's going wrong is you provide an Array to the Amadeus\Client\Params::$authParams, while it should be an instance of Amadeus\Client\Params\AuthParams.

The result is that the Authentication parameters are not picked up properly. That's why you're sending an empty Security_Authenticate.

I realize that this is not very intuitive, and in the future I'd like to be able to provide one big nested Array for Client instantiation, but that's work in progress.

Please let me know if that fixes your problem.

@icaroce
Copy link
Author

icaroce commented Feb 15, 2017

Now works great. :)

@icaroce
Copy link
Author

icaroce commented Feb 15, 2017

Thanks for your help.

@DerMika
Copy link
Collaborator

DerMika commented Mar 6, 2017

Ok, I found what went wrong with your security authenticate: there is an error in the documentation in the authentication parameters. I'm going to fix it now...

DerMika added a commit that referenced this issue Mar 6, 2017
… to Client AuthParams causing Security_Authenticate message to fail when using SoapHeader 2. (#40)
@DerMika DerMika added the bug label Mar 6, 2017
@DerMika DerMika reopened this Mar 6, 2017
@DerMika
Copy link
Collaborator

DerMika commented Mar 6, 2017

So the problem was that the Security_Authenticate message uses authentication params defined at the Amadeus\Client\Params::$authParams level, but the documentation shows that authentication should be provided at Amadeus\Client\Params\SessionHandlerParams::$authParams level.

Doing so resulted in empty authentication parameters in the Client, which resulted in a Security_Authenticate with empty parameters. This is what you experienced.

I've now fixed:

  • the documentation to set the auth params at the correct level
  • the loading of params so that it doesn't matter at which level you define authentication parameters, both will work.

@DerMika DerMika closed this as completed Mar 6, 2017
DerMika added a commit that referenced this issue Mar 6, 2017
DerMika added a commit that referenced this issue Mar 6, 2017
… to Client AuthParams causing Security_Authenticate message to fail when using SoapHeader 2. (#40)
atomy pushed a commit to mlamm/amadeus-ws-client that referenced this issue Nov 26, 2018
…AN-769-search-compare-add-more-data-to-all to master

* commit '95773d71a6c8fb637608c9e86b7fa0a31944cda6':
  (change) register error logger only when needed
  (add) specific error logger to log information based on status code
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

2 participants