Travelport / travelport-uapi-tutorial-php

The travelport-uapi-tutorial-php is a PHP project for Universal API that will help you connect and code a standard workflow including Air, Vehicle, and Hotel.
35 stars 47 forks source link

object has no 'HotelStay' property #164

Closed MasoodRehman closed 6 years ago

MasoodRehman commented 6 years ago

During development on localhost no such type of error throwing by API but as i uploaded the code on server the following exception fired by API on HotelDetails request.

Message: SOAP Fault: (faultcode: Client, faultstring: SOAP-ERROR: Encoding: object has no 'HotelStay' property)

Request Object

HotelDetails Object
(
    [HostToken] => 
    [TargetBranch] => P7096532
    [AuthorizedBy] => user
    [TraceId] => trace
    [ReturnMediaLinks] => 1
    [BillingPointOfSaleInfo] => BillingPointOfSaleInfo Object
        (
            [OriginApplication] => UAPI
        )
    [HotelDetailsModifiers] => HotelDetailsModifiers Object
        (
            [NumberOfAdults] => 2
            [NumberOfRooms] => 1
            [RateRuleDetail] => Complete
            [PermittedProviders] => PermittedProviders Object
                (
                    [Provider] => Provider Object
                        (
                            [Code] => 1G
                        )
                )
            [HotelStay] => HotelStay Object
                (
                    [CheckinDate] => 2018-08-13
                    [CheckoutDate] => 2018-08-14
                )
            [PermittedAggregators] => PermittedAggregators Object
                (
                    [Aggregator] => Aggregator Object
                        (
                            [Name] => 
                        )
                )
            [BookingGuestInformation] => BookingGuestInformation Object
                (
                    [Room] => Array
                        (
                            [0] => Room Object
                                (
                                    [Adults] => 2
                                )
                        )
                )
        )
    [HotelProperty] => HotelProperty Object
        (
            [HotelChain] => HI
            [HotelCode] => 05041
        )
)
vivekjyotipramanik commented 6 years ago

Hi MasoodRehman,

Please share the XML request. Thanks.

MasoodRehman commented 6 years ago

Hi @vivekjyotipramanik,

Following is my XML Request kindly preview it, I am worried why it gives error on server.

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope 
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
    xmlns:ns1="http://www.travelport.com/schema/common_v42_0" 
    xmlns:ns2="http://www.travelport.com/schema/hotel_v42_0">
    <SOAP-ENV:Body>
        <ns2:HotelDetailsReq TraceId="trace" AuthorizedBy="user" TargetBranch="P7096532" ReturnMediaLinks="true">
            <ns1:BillingPointOfSaleInfo OriginApplication="UAPI" />
            <ns2:HotelProperty HotelChain="HY" HotelCode="53881" />
            <ns2:HotelDetailsModifiers NumberOfAdults="2" RateRuleDetail="Complete" NumberOfRooms="1">
                <ns1:PermittedProviders>
                    <ns1:Provider Code="1G" />
                </ns1:PermittedProviders>
                <ns2:HotelStay>
                    <ns2:CheckinDate>2018-08-15</ns2:CheckinDate>
                    <ns2:CheckoutDate>2018-08-16</ns2:CheckoutDate>
                </ns2:HotelStay>
                <ns2:PermittedAggregators>
                    <ns2:Aggregator Name="" />
                </ns2:PermittedAggregators>
                <ns2:BookingGuestInformation>
                    <ns2:Room>
                        <ns2:Adults>2</ns2:Adults>
                    </ns2:Room>
                </ns2:BookingGuestInformation>
            </ns2:HotelDetailsModifiers>
            <ns1:HostToken></ns1:HostToken>
        </ns2:HotelDetailsReq>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
vivekjyotipramanik commented 6 years ago

Hi MasoodRehman,

Please remove the PermittedAggregators if you are sending name as blank. Name is a mandatory field and needs to have a value if you are adding PermittedAggregators. Please try with the below request. Thanks.

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope 
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
    xmlns:ns1="http://www.travelport.com/schema/common_v42_0" 
    xmlns:ns2="http://www.travelport.com/schema/hotel_v42_0">
    <SOAP-ENV:Body>
        <ns2:HotelDetailsReq TraceId="trace" AuthorizedBy="user" TargetBranch="P7096532" ReturnMediaLinks="true">
            <ns1:BillingPointOfSaleInfo OriginApplication="UAPI" />
            <ns2:HotelProperty HotelChain="HY" HotelCode="53881" />
            <ns2:HotelDetailsModifiers NumberOfAdults="2" RateRuleDetail="Complete" NumberOfRooms="1">
                <ns1:PermittedProviders>
                    <ns1:Provider Code="1G" />
                </ns1:PermittedProviders>
                <ns2:HotelStay>
                    <ns2:CheckinDate>2018-08-15</ns2:CheckinDate>
                    <ns2:CheckoutDate>2018-08-16</ns2:CheckoutDate>
                </ns2:HotelStay>
                <ns2:BookingGuestInformation>
                    <ns2:Room>
                        <ns2:Adults>2</ns2:Adults>
                    </ns2:Room>
                </ns2:BookingGuestInformation>
            </ns2:HotelDetailsModifiers>
        </ns2:HotelDetailsReq>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
MasoodRehman commented 6 years ago

OK Let me try.

MasoodRehman commented 6 years ago

Hi @vivekjyotipramanik,

Now the request is exactly the same as you mentioned in reply but the response is the same.

SOAP-ERROR: Encoding: object has no 'HotelStay' property

MasoodRehman commented 6 years ago

On localhost host I tried all request HotelSearch, HotelDetails and HotelReservation and all of them working despite i provide PermittedAggregators with empty Name attribute generate no issues. But on live server after HotelSearch request the error generate on HotelDetails request. @vivekjyotipramanik,

vivekjyotipramanik commented 6 years ago

Hi MasoodRehman,

When you say, on live server, Could you please elaborate. If it is working in localhost it should work on server as well. Are you using PreProduction or Production credentials, if yes, Could you please raise a MyTravelport ticket for the same. Thanks.

MasoodRehman commented 6 years ago

Hi @vivekjyotipramanik,

By localhost i mean my local PC and from server i mean my online domain where i deployed my website.

Our uAPI is preproduction one.

Kindly guide me how to open a ticket in MyTravelport, can you send a link.

Thanks.

vivekjyotipramanik commented 6 years ago

Hi MasoodRehman,

Please find below the link for MyTravelport. Thanks.

MyTravelport Helpsite : https://support.travelport.com/webhelp/MyTravelport/en-us/Default.htm

Actual site: https://my.travelport.com

MasoodRehman commented 6 years ago

Thank you @vivekjyotipramanik for your cooperation for the last issue which has been solved.

Now there is another issue in booking request. Kindly check my payload request what's wrong with it. On booking reservation request I received the following response from API

SOAP Fault: (faultcode: Server.System, faultstring: could not generate a supplierlocatorcode)

Following is my request payload

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.travelport.com/schema/common_v42_0" xmlns:ns2="http://www.travelport.com/schema/hotel_v42_0" xmlns:ns3="http://www.travelport.com/schema/universal_v42_0">
    <SOAP-ENV:Body>
        <ns3:HotelCreateReservationReq TraceId="trace" AuthorizedBy="user" TargetBranch="P7096532" ProviderCode="1G">
            <ns1:BillingPointOfSaleInfo OriginApplication="UAPI" />
            <ns1:BookingTraveler>
                <ns1:BookingTravelerName First="Masood" Last="Rehman" />
                <ns1:PhoneNumber Number="03339227639" />
                <ns1:Email EmailID="masoodurrehman42@gmail.com" />
                <ns1:Address>
                    <ns1:AddressName>Home</ns1:AddressName>
                    <ns1:Street>Lahore</ns1:Street>
                    <ns1:City>Lahore</ns1:City>
                    <ns1:State>Lahore</ns1:State>
                    <ns1:PostalCode>44000</ns1:PostalCode>
                    <ns1:Country>PK</ns1:Country>
                </ns1:Address>
            </ns1:BookingTraveler>
            <ns2:HotelRateDetail RatePlanType="KNGRACK" />
            <ns2:HotelProperty HotelChain="HY" HotelCode="53881" />
            <ns2:HotelStay>
                <ns2:CheckinDate>2018-08-20</ns2:CheckinDate>
                <ns2:CheckoutDate>2018-08-21</ns2:CheckoutDate>
            </ns2:HotelStay>
            <ns1:Guarantee Type="Guarantee">
                <ns1:CreditCard Type="CA" Number="5412675985890474" ExpDate="2018-12" CVV="900" />
            </ns1:Guarantee>
            <ns2:GuestInformation NumberOfRooms="1">
                <ns2:NumberOfAdults>2</ns2:NumberOfAdults>
            </ns2:GuestInformation>
        </ns3:HotelCreateReservationReq>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Note: The data used in request are fake e.g CC details.

vivekjyotipramanik commented 6 years ago

Hi MasoodRehman,

Could you please share the complete response xml. Just to add, even if you are using fake credit card, the credit card should be a valid credit card number based on Luhn algorithm. Thanks.

MasoodRehman commented 6 years ago

I tried a booking this time it worked :) Will inform you if this happen again. Thanks.