amadeus-ws-client icon indicating copy to clipboard operation
amadeus-ws-client copied to clipboard

Hotel booking flow support

Open DerMika opened this issue 7 years ago • 17 comments

Working on supporting the Amadeus Hotel booking flow:

  • Hotel_MultiSingleAvailability
  • Hotel_DescriptiveInfo
  • Hotel_EnhancedPricing
  • Hotel_Sell

Development is happening on the hotel branch.

However, there's a number of firsts here:

  • Use of separate WSDL files (Hotel "Interface" wsdl's, as Amadeus calls it) - see Support for Multiple WSDL's
  • Using the OTA XML format with attributes and complex XSD structures.
  • Requiring the use of message-specific extra classmaps in the SoapClient's construction.

DerMika avatar Apr 27 '17 08:04 DerMika

I'm currently stuck on a translation from PHP objects to XSD objects on the Criterion / HotelSearchCriterionType / ItemSearchCriterionType. The Criterion object seems to be recognized, but any properties that are defined in HotelSearchCriterionType or ItemSearchCriterionType do not seem to get translated into the XML message being sent out.

You can test this yourself by doing the following Hotel_MultiSingleAvailability call:

use Amadeus\Client\RequestOptions\HotelMultiSingleAvailOptions;
use Amadeus\Client\RequestOptions\Hotel\MultiSingleAvail\Criteria;
use Amadeus\Client\RequestOptions\Hotel\MultiSingleAvail\Guest;
use Amadeus\Client\RequestOptions\Hotel\MultiSingleAvail\HotelReference;
use Amadeus\Client\RequestOptions\Hotel\MultiSingleAvail\Rates;
use Amadeus\Client\RequestOptions\Hotel\MultiSingleAvail\Room;
use Amadeus\Client\RequestOptions\Hotel\MultiSingleAvail\Segment;

$availabilityResponse = $client->hotelMultiSingleAvailability(
    new HotelMultiSingleAvailOptions([
        'segments' => [
            new Segment([
                'infoSource' => Segment::SOURCE_DISTRIBUTION,
                'criteria' => [
                    new Criteria([
                        'exactMatch' => true,
                        'stayStart' => \DateTime::createFromFormat('Y-m-d', '2017-12-28'),
                        'stayEnd' => \DateTime::createFromFormat('Y-m-d', '2017-12-29'),
                        'hotelReferences' => [
                            new HotelReference([
                                'chainCode' => 'RT',
                                'cityCode' => 'VIE',
                                'name' => 'SOFITEL VIENNA'
                            ])
                        ],
                        'rates' => [
                            new Rates([
                                'min' => 100.0,
                                'max' => 400.0,
                                'timeUnit' => Rates::TIMEUNIT_DAY
                            ])
                        ],
                        'rooms' => [
                            new Room([
                                'id' => 1,
                                'amount' => 1,
                                'guests' => [
                                    new Guest([
                                        'occupantCode' => Guest::OCCUPANT_ADULT,
                                        'amount' => 1
                                    ])
                                ]
                            ])
                        ]
                    ])
                ]
            ])
        ]
    ])
);

Currently this produces the following XML:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Soap headers & envelope omitted -->
<SOAP-ENV:Body>
	<ns1:OTA_HotelAvailRQ SummaryOnly="true" RateRangeOnly="true" RateDetailsInd="true" EchoToken="MultiSingle" Version="4.000">
		<ns1:AvailRequestSegments>
			<ns1:AvailRequestSegment InfoSource="Distribution">
				<ns1:HotelSearchCriteria AvailableOnlyIndicator="true">
					<ns1:Criterion/>
				</ns1:HotelSearchCriteria>
			</ns1:AvailRequestSegment>
		</ns1:AvailRequestSegments>
	</ns1:OTA_HotelAvailRQ>
</SOAP-ENV:Body>

Criterion is an element defined in an XSD imported in the WSDL (OTA_HotelCommonTypes.xsd) as an extension of the HotelSearchCriterionType complexType , which is an extension of the complexType ItemSearchCriterionType defined in an included OTA_CommonTypes.xsd

For some reason, the SoapClient is not recognizing the link between XSD type HotelSearchCriterionType and Amadeus\Client\Struct\Hotel\MultiSingleAvailability\HotelSearchCriterionType

To be investigated.

DerMika avatar Apr 27 '17 09:04 DerMika

Why getting this error

[29-Oct-2018 17:44:12 UTC] PHP Fatal error: Uncaught Amadeus\Client\InvalidMessageException: Message "Hotel_MultiSingleAvailability" is not in WDSL in /home/travoweb/public_html/amadeus_hoel/src/Amadeus/Client/RequestCreator/Base.php:118 Stack trace: #0 /home/travoweb/public_html/amadeus_hoel/src/Amadeus/Client/RequestCreator/Base.php(98): Amadeus\Client\RequestCreator\Base->checkMessageIsInWsdl('Hotel_MultiSing...') #1 /home/travoweb/public_html/amadeus_hoel/src/Amadeus/Client.php(1104): Amadeus\Client\RequestCreator\Base->createRequest('Hotel_MultiSing...', Object(Amadeus\Client\RequestOptions\HotelMultiSingleAvailOptions)) #2 /home/travoweb/public_html/amadeus_hoel/src/Amadeus/Client.php(1013): Amadeus\Client->callMessage('Hotel_MultiSing...', Object(Amadeus\Client\RequestOptions\HotelMultiSingleAvailOptions), Array) #3 /home/travoweb/public_html/amadeus_hoel/TEST_Hotel_Data.php(68): Amadeus\Client->hotelMultiSingleAvailability(Object(Amadeus\Client\RequestOptions\HotelMultiSingleAvailOptions)) #4 {main} thrown in /home/travoweb/public_html/amadeus_hoel/src/Amadeus/Client/RequestCreator/Base.php on line 118

saaqeb avatar Oct 29 '18 17:10 saaqeb

@saaqeb which WSDL file you using in Client?

therealartz avatar Oct 29 '18 18:10 therealartz

my own wsdl

saaqeb avatar Oct 29 '18 18:10 saaqeb

@saaqeb HotelAvailability_2.0_4.0.wsdl?

therealartz avatar Oct 29 '18 18:10 therealartz

HotelAvailability_2.0.wsdl

saaqeb avatar Oct 29 '18 18:10 saaqeb

[ 'officeId' => 'XXXXXX', //The Amadeus Office Id you want to sign in to - must be open on your WSAP. 'userId' => 'XXXXXX', //Also known as 'Originator' for Soap Header 1 & 2 WSDL's 'passwordData' => 'XXXXX' // **base 64 encoded** password ], 'sessionHandlerParams' => [ 'soapHeaderVersion' => Client::HEADER_V4, 'wsdl' => '/home/travoweb/public_html/amadeus_sandbox/1ASIWOTANA4_PDT_20180321_161425/HotelAvailability_2.0.wsdl', 'stateful' => true, 'logger' => new Psr\Log\NullLogger() ], 'requestCreatorParams' => [ 'receivedFrom' => 'Saaqeb Nayeem Hotel TravoJet' ] ]); $client = new Client($params); use Amadeus\Client\RequestOptions\HotelMultiSingleAvailOptions; use Amadeus\Client\RequestOptions\Hotel\MultiSingleAvail\Criteria; use Amadeus\Client\RequestOptions\Hotel\MultiSingleAvail\Guest; use Amadeus\Client\RequestOptions\Hotel\MultiSingleAvail\HotelReference; use Amadeus\Client\RequestOptions\Hotel\MultiSingleAvail\Rates; use Amadeus\Client\RequestOptions\Hotel\MultiSingleAvail\Room; use Amadeus\Client\RequestOptions\Hotel\MultiSingleAvail\Segment; $availabilityResponse = $client->hotelMultiSingleAvailability( new HotelMultiSingleAvailOptions([ 'segments' => [ new Segment([ 'infoSource' => Segment::SOURCE_DISTRIBUTION, 'criteria' => [ new Criteria([ 'exactMatch' => true, 'stayStart' => \DateTime::createFromFormat('Y-m-d', '2018-12-28'), 'stayEnd' => \DateTime::createFromFormat('Y-m-d', '2018-12-29'), 'hotelReferences' => [ new HotelReference([ 'chainCode' => 'RT', 'cityCode' => 'VIE', 'name' => 'SOFITEL VIENNA' ]) ], 'rates' => [ new Rates([ 'min' => 100.0, 'max' => 400.0, 'timeUnit' => Rates::TIMEUNIT_DAY ]) ], 'rooms' => [ new Room([ 'id' => 1, 'amount' => 1, 'guests' => [ new Guest([ 'occupantCode' => Guest::OCCUPANT_ADULT, 'amount' => 1 ]) ] ]) ] ]) ] ]) ] ]) ); $HotelInfo = json_encode($params); $HotelInfo = json_decode($HotelInfo, true); print"

";
print_r($HotelInfo);
print"
"; exit; ?>

saaqeb avatar Oct 29 '18 18:10 saaqeb

So... you getting this error because message Hotel_MultiSingleAvailability are not found in your WSDL schema.

Probably you just don't have access to this web service. Or maybe you should re-download schemas from extranet page.

Yours HotelAvailability_2.0.wsdl file should contain such tags:

<wsdl:operation name="Hotel_MultiSingleAvailability">
    <soap:operation soapAction="http://webservices.amadeus.com/Hotel_MultiSingleAvailability_10.0" />
    ...

therealartz avatar Oct 29 '18 18:10 therealartz

Now i am getting this error

`Array ( [status] => FATAL [messages] => Array ( [0] => Array ( [code] => 18 [text] => [level] => Application [source] => )

    )

[response] => 
[responseXml] => soap:Server 18|Application|

)`

saaqeb avatar Oct 29 '18 19:10 saaqeb

Are you using the hotel implementation from the hotel branch? You should know that it is not functional. It is still a work in progress (although I no longer have the time to work on it), so expect to encounter bugs if you try to use it.

DerMika avatar Nov 01 '18 12:11 DerMika

I'm currently stuck on a translation from PHP objects to XSD objects on the Criterion / HotelSearchCriterionType / ItemSearchCriterionType. The Criterion object seems to be recognized, but any properties that are defined in HotelSearchCriterionType or ItemSearchCriterionType do not seem to get translated into the XML message being sent out.

You can test this yourself by doing the following Hotel_MultiSingleAvailability call:

use Amadeus\Client\RequestOptions\HotelMultiSingleAvailOptions;
use Amadeus\Client\RequestOptions\Hotel\MultiSingleAvail\Criteria;
use Amadeus\Client\RequestOptions\Hotel\MultiSingleAvail\Guest;
use Amadeus\Client\RequestOptions\Hotel\MultiSingleAvail\HotelReference;
use Amadeus\Client\RequestOptions\Hotel\MultiSingleAvail\Rates;
use Amadeus\Client\RequestOptions\Hotel\MultiSingleAvail\Room;
use Amadeus\Client\RequestOptions\Hotel\MultiSingleAvail\Segment;

$availabilityResponse = $client->hotelMultiSingleAvailability(
    new HotelMultiSingleAvailOptions([
        'segments' => [
            new Segment([
                'infoSource' => Segment::SOURCE_DISTRIBUTION,
                'criteria' => [
                    new Criteria([
                        'exactMatch' => true,
                        'stayStart' => \DateTime::createFromFormat('Y-m-d', '2017-12-28'),
                        'stayEnd' => \DateTime::createFromFormat('Y-m-d', '2017-12-29'),
                        'hotelReferences' => [
                            new HotelReference([
                                'chainCode' => 'RT',
                                'cityCode' => 'VIE',
                                'name' => 'SOFITEL VIENNA'
                            ])
                        ],
                        'rates' => [
                            new Rates([
                                'min' => 100.0,
                                'max' => 400.0,
                                'timeUnit' => Rates::TIMEUNIT_DAY
                            ])
                        ],
                        'rooms' => [
                            new Room([
                                'id' => 1,
                                'amount' => 1,
                                'guests' => [
                                    new Guest([
                                        'occupantCode' => Guest::OCCUPANT_ADULT,
                                        'amount' => 1
                                    ])
                                ]
                            ])
                        ]
                    ])
                ]
            ])
        ]
    ])
);

Currently this produces the following XML:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Soap headers & envelope omitted -->
<SOAP-ENV:Body>
	<ns1:OTA_HotelAvailRQ SummaryOnly="true" RateRangeOnly="true" RateDetailsInd="true" EchoToken="MultiSingle" Version="4.000">
		<ns1:AvailRequestSegments>
			<ns1:AvailRequestSegment InfoSource="Distribution">
				<ns1:HotelSearchCriteria AvailableOnlyIndicator="true">
					<ns1:Criterion/>
				</ns1:HotelSearchCriteria>
			</ns1:AvailRequestSegment>
		</ns1:AvailRequestSegments>
	</ns1:OTA_HotelAvailRQ>
</SOAP-ENV:Body>

Criterion is an element defined in an XSD imported in the WSDL (OTA_HotelCommonTypes.xsd) as an extension of the HotelSearchCriterionType complexType , which is an extension of the complexType ItemSearchCriterionType defined in an included OTA_CommonTypes.xsd

For some reason, the SoapClient is not recognizing the link between XSD type HotelSearchCriterionType and Amadeus\Client\Struct\Hotel\MultiSingleAvailability\HotelSearchCriterionType

To be investigated.

Hello, I also encountered the same problem when concatenating. Is there any way to solve it now? Thanks.

o150209001 avatar Sep 20 '19 01:09 o150209001

@o150209001 some guys solved this problem that way https://github.com/amabnl/amadeus-ws-client/pull/336/commits/f9bb82b0c7ec2d3d177284773f1033e726d08b69#diff-d667c14c7bed52a489b12df97a37c844R132 I guess

therealartz avatar Sep 20 '19 06:09 therealartz

@o150209001 some guys solved this problem that way f9bb82b#diff-d667c14c7bed52a489b12df97a37c844R132 I guess

Hello,I tried this ,but it's not working. The problem is still the same. Criterion element is disappear. <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.opentravel.org/OTA/2003/05" xmlns:ns2="http://www.w3.org/2005/08/addressing" xmlns:ns3="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wsswssecurity-secext-1.0.xsd" xmlns:ns4="http://xml.amadeus.com/2010/06/Session_v3" xmlns:ns5="http://xml.amadeus.com/2010/06/Security_v1"> <SOAP-ENV:Body> <ns1:OTA_HotelAvailRQ SummaryOnly="true" SortOrder="N" AvailRatesOnly="true" RateRangeOnly="true" ExactMatchOnly="true" RateDetailsInd="true" EchoToken="MultiSingle" Version="4.000" MaxResponses="90"> <ns1:AvailRequestSegments> <ns1:AvailRequestSegment InfoSource="Distribution"> <ns1:HotelSearchCriteria AvailableOnlyIndicator="true" BestOnlyIndicator="true"> <ns1:Criterion/> </ns1:HotelSearchCriteria> </ns1:AvailRequestSegment> </ns1:AvailRequestSegments> </ns1:OTA_HotelAvailRQ> </SOAP-ENV:Body> </SOAP-ENV:Envelope>

Thanks.

o150209001 avatar Sep 20 '19 09:09 o150209001

Hello, Whats The latest for hotels,cars SOAP API? any development? Please guide me how can i integrate these modules in my project without new authentication

alaskaenterprises avatar Mar 04 '20 14:03 alaskaenterprises

@DerMika we had also an error with empty Criterion xml node, but only in case when we used PDT files. Everything started to work with "adapted" TST wsdl files.

s-code avatar Mar 12 '21 15:03 s-code

Can I have sample of how to request "Hotel_DescriptiveInfo" please? thank you

stevensoe0524 avatar May 21 '21 01:05 stevensoe0524

Can I have sample of how to request "Hotel_DescriptiveInfo" please? thank you

did you get any sample file for this

HariBeedev avatar Jan 11 '24 03:01 HariBeedev