src/Amadeus/Client/Session/Handler/SoapHeader2.php
protected function prepareForNextMessage($messageName, $messageOptions)
    {
        if (!$this->isAuthenticated && $messageName !== 'Security_Authenticate') {
            throw new InvalidSessionException('No active session');
        }

        $this->getSoapClient($messageName)->__setSoapHeaders(null);

        if ($this->isAuthenticated === true && is_int($this->sessionData['sequenceNumber'])) {
            $this->sessionData['sequenceNumber']++;

            $session = new Client\Struct\HeaderV2\Session(
                $this->sessionData['sessionId'],
                $this->sessionData['sequenceNumber'],
                $this->sessionData['securityToken']
            );

            $this->getSoapClient($messageName)->__setSoapHeaders(
                new \SoapHeader(self::CORE_WS_V2_SESSION_NS, self::NODENAME_SESSION, $session)
            );
        }
    }
protected function prepareForNextMessage($messageName, $messageOptions)
    {
        if (!$this->isAuthenticated && $messageName !== 'Security_Authenticate') {
            throw new InvalidSessionException('No active session');
        }

        $this->getSoapClient($messageName)->__setSoapHeaders(null);

        if ($this->isAuthenticated === true && is_int($this->sessionData['sequenceNumber'])) {
            $this->sessionData['sequenceNumber']++;

            $session = new Client\Struct\HeaderV2\Session(
                $this->sessionData['sessionId'],
                $this->sessionData['sequenceNumber'],
                $this->sessionData['securityToken']
            );

            $this->getSoapClient($messageName)->__setSoapHeaders(
                new \SoapHeader(self::CORE_WS_V2_SESSION_NS, self::NODENAME_SESSION, $session)
            );
        }
    }
Prepare to send a next message and checks if authenticated

@param string $messageName
@param array $messageOptions
@throws InvalidSessionException When trying to send a message without session.