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

Error recognizing message versions in Request Creator #71

Closed
bimusiek opened this issue Apr 27, 2017 · 20 comments
Closed

Error recognizing message versions in Request Creator #71

bimusiek opened this issue Apr 27, 2017 · 20 comments
Labels
Milestone

Comments

@bimusiek
Copy link
Collaborator

bimusiek commented Apr 27, 2017

Hey, I just updated the lib to newest master and when doing pricing I am getting

[SOAP-ERROR: Encoding: object has no 'pricingOptionGroup' property] 

My code:

private function pricePnr($currency) {
        $options =  [
            'ticketType' => FarePricePnrWithBookingClassOptions::TICKET_TYPE_ELECTRONIC,
            'currencyOverride' => $currency
        ];
        $pricingResponse = $this->client->farePricePnrWithBookingClass(
            new FarePricePnrWithBookingClassOptions($options)
        );
        return $pricingResponse;
    }

And error:

SOAPFAULT while sending message Fare_PricePNRWithBookingClass: SOAP-ERROR: Encoding: object has no 'pricingOptionGroup' property code: 0 at /var/www/html/vendor/amabnl/amadeus-ws-client/src/Amadeus/Client/Session/Handler/Base.php line 194:  
#0 /var/www/html/vendor/amabnl/amadeus-ws-client/src/Amadeus/Client/Session/Handler/Base.php(194): SoapClient->__call('Fare_PricePNRWi...', Array) 
#1 /var/www/html/vendor/amabnl/amadeus-ws-client/src/Amadeus/Client.php(1072): Amadeus\Client\Session\Handler\Base->sendMessage('Fare_PricePNRWi...', Object(Amadeus\Client\Struct\Fare\PricePNRWithBookingClass12), Array) 
#2 /var/www/html/vendor/amabnl/amadeus-ws-client/src/Amadeus/Client.php(508): Amadeus\Client->callMessage('Fare_PricePNRWi...', Object(Amadeus\Client\RequestOptions\FarePricePnrWithBookingClassOptions), Array) 
#3 /var/www/html/amadeus/apps/booking/manager.php(177): Amadeus\Client->farePricePnrWithBookingClass(Object(Amadeus\Client\RequestOptions\FarePricePnrWithBookingClassOptions)) 

I have 14.1 version of this endpoint but I see lib is using version 12?
Any ideas what is wrong? I tried to look in the code but did not find anything that can cause this issue.

@DerMika
Copy link
Collaborator

DerMika commented Apr 27, 2017

Well, I did fix a bug recently that may have changed the way the Pricing messages are being constructed.

Could you step through the code and see if Amadeus\Client\RequestCreator\Converter\Fare\PricePNRWithBookingClassConv creates a PricePNRWithBookingClass12 or a PricePNRWithBookingClass13 message, and if this is consistent with the version in your WSDL?

@bimusiek
Copy link
Collaborator Author

Lib is using PricePNRWithBookingClass12 however the version I have is 14.1.1

@DerMika
Copy link
Collaborator

DerMika commented Apr 27, 2017

well shit.

@DerMika
Copy link
Collaborator

DerMika commented Apr 27, 2017

What PHP version are you running? And what OS?

@bimusiek
Copy link
Collaborator Author

bimusiek commented Apr 27, 2017

It is dockerized container php:fpm. It uses debian:jessie and php 7.1.

ENV PHP_VERSION 7.1.4
ENV PHP_URL="https://secure.php.net/get/php-7.1.4.tar.xz/from/this/mirror" PHP_ASC_URL="https://secure.php.net/get/php-7.1.4.tar.xz.asc/from/this/mirror"
ENV PHP_SHA256="71514386adf3e963df087c2044a0b3747900b8b1fc8da3a99f0a0ae9180d300b" PHP_MD5="a74c13f8779349872b365e6732e8c98e"

@bimusiek
Copy link
Collaborator Author

How do you recognise version in the lib? I think the code change should not break it as I checked:

php > var_dump(floatval('14.1.1') < floatval(13));
php shell code:1:
bool(false)
php > var_dump('14.1.1' < 13);
php shell code:1:
bool(false)
php > var_dump('14.1.1A' < 13);
php shell code:1:
bool(false)
php > var_dump(floatval('14.1.1A') < floatval(13));
php shell code:1:
bool(false)
php > var_dump(floatval('14_1_1A') < floatval(13));
php shell code:1:
bool(false)
php > var_dump('14_1_1A' < 13);
php shell code:1:
bool(false)

@DerMika
Copy link
Collaborator

DerMika commented Apr 27, 2017

That's done in the WsdlAnalyzer, which checks which messages and versions of messages are defined in the WSDL you've provided.

@DerMika
Copy link
Collaborator

DerMika commented Apr 27, 2017

You don't happen to have multiple versions of this message in your WSDL?

@bimusiek
Copy link
Collaborator Author

No, just this one.

      <xs:import namespace="http://xml.amadeus.com/TIPNRQ_14_1_1A" schemaLocation="Fare_InformativePricingWithoutPNR_14_1_1A.xsd" />
      <xs:import namespace="http://xml.amadeus.com/TIPNRR_14_1_1A" schemaLocation="Fare_InformativePricingWithoutPNRReply_14_1_1A.xsd" />

@bimusiek
Copy link
Collaborator Author

bimusiek commented Apr 27, 2017

This is quite weird, it should still work:

php > $fullVersionString = "Fare_InformativePricingWithoutPNR_14_1_1A";
php > $marker = strpos($fullVersionString, '_', strpos($fullVersionString, '_') + 1);
php >         $num = substr($fullVersionString, $marker + 1);
php > var_dump($num);
string(7) "14_1_1A"
php > var_dump(str_replace('_', '.', $num));
string(7) "14.1.1A"
php > var_dump(floatval('14.1.1A') < floatval(13));
bool(false)

@DerMika
Copy link
Collaborator

DerMika commented Apr 27, 2017

Can you add the following line to Amadeus\Client\Session\Handler\Base after line 321 and let me know the contents of the var_dump?

var_dump($this->messagesAndVersions); die();

@bimusiek
Copy link
Collaborator Author

bimusiek commented Apr 27, 2017

/var/www/html/vendor/amabnl/amadeus-ws-client/src/Amadeus/Client/Session/Handler/Base.php:322:
array (size=39)
  'Air_FlightInfo' => 
    array (size=2)
      'version' => string '7.1' (length=3)
      'wsdl' => string 'dc22e4ee' (length=8)
  'Air_RebookAirSegment' => 
    array (size=2)
      'version' => string '3.2' (length=3)
      'wsdl' => string 'dc22e4ee' (length=8)
  'Air_SellFromRecommendation' => 
    array (size=2)
      'version' => string '5.2' (length=3)
      'wsdl' => string 'dc22e4ee' (length=8)
  'Command_Cryptic' => 
    array (size=2)
      'version' => string '7.3' (length=3)
      'wsdl' => string 'dc22e4ee' (length=8)
  'DocIssuance_IssueCombined' => 
    array (size=2)
      'version' => string '15.1' (length=4)
      'wsdl' => string 'dc22e4ee' (length=8)
  'DocIssuance_IssueMiscellaneousDocuments' => 
    array (size=2)
      'version' => string '15.1' (length=4)
      'wsdl' => string 'dc22e4ee' (length=8)
  'DocIssuance_IssueTicket' => 
    array (size=2)
      'version' => string '15.1' (length=4)
      'wsdl' => string 'dc22e4ee' (length=8)
  'DocRefund_InitRefund' => 
    array (size=2)
      'version' => string '13.1' (length=4)
      'wsdl' => string 'dc22e4ee' (length=8)
  'DocRefund_ProcessRefund' => 
    array (size=2)
      'version' => string '13.1' (length=4)
      'wsdl' => string 'dc22e4ee' (length=8)
  'DocRefund_UpdateRefund' => 
    array (size=2)
      'version' => string '13.1' (length=4)
      'wsdl' => string 'dc22e4ee' (length=8)
  'FOP_CreateFormOfPayment' => 
    array (size=2)
      'version' => string '14.6' (length=4)
      'wsdl' => string 'dc22e4ee' (length=8)
  'Fare_CheckRules' => 
    array (size=2)
      'version' => string '7.1' (length=3)
      'wsdl' => string 'dc22e4ee' (length=8)
  'Fare_ConvertCurrency' => 
    array (size=2)
      'version' => string '8.1' (length=3)
      'wsdl' => string 'dc22e4ee' (length=8)
  'Fare_InformativePricingWithoutPNR' => 
    array (size=2)
      'version' => string '14.1' (length=4)
      'wsdl' => string 'dc22e4ee' (length=8)
  'Fare_MasterPricerTravelBoardSearch' => 
    array (size=2)
      'version' => string '14.3' (length=4)
      'wsdl' => string 'dc22e4ee' (length=8)
  'Fare_PricePNRWithBookingClass' => 
    array (size=2)
      'version' => string '14.1' (length=4)
      'wsdl' => string 'dc22e4ee' (length=8)
  'MiniRule_GetFromETicket' => 
    array (size=2)
      'version' => string '13.1' (length=4)
      'wsdl' => string 'dc22e4ee' (length=8)
  'MiniRule_GetFromPricing' => 
    array (size=2)
      'version' => string '11.1' (length=4)
      'wsdl' => string 'dc22e4ee' (length=8)
  'MiniRule_GetFromPricingRec' => 
    array (size=2)
      'version' => string '11.1' (length=4)
      'wsdl' => string 'dc22e4ee' (length=8)
  'PNR_AddMultiElements' => 
    array (size=2)
      'version' => string '14.2' (length=4)
      'wsdl' => string 'dc22e4ee' (length=8)
  'PNR_Cancel' => 
    array (size=2)
      'version' => string '14.2' (length=4)
      'wsdl' => string 'dc22e4ee' (length=8)
  'PNR_Retrieve' => 
    array (size=2)
      'version' => string '14.2' (length=4)
      'wsdl' => string 'dc22e4ee' (length=8)
  'PNR_Search' => 
    array (size=2)
      'version' => string '15.1' (length=4)
      'wsdl' => string 'dc22e4ee' (length=8)
  'Queue_PlacePNR' => 
    array (size=2)
      'version' => string '3.1' (length=3)
      'wsdl' => string 'dc22e4ee' (length=8)
  'Security_Authenticate' => 
    array (size=2)
      'version' => string '6.1' (length=3)
      'wsdl' => string 'dc22e4ee' (length=8)
  'Security_SignOut' => 
    array (size=2)
      'version' => string '4.1' (length=3)
      'wsdl' => string 'dc22e4ee' (length=8)
  'Service_IntegratedPricing' => 
    array (size=2)
      'version' => string '15.1' (length=4)
      'wsdl' => string 'dc22e4ee' (length=8)
  'Service_StandaloneCatalogue' => 
    array (size=2)
      'version' => string '16.1' (length=4)
      'wsdl' => string 'dc22e4ee' (length=8)
  'Ticket_ATCShopperMasterPricerTravelBoardSearch' => 
    array (size=2)
      'version' => string '13.1' (length=4)
      'wsdl' => string 'dc22e4ee' (length=8)
  'Ticket_CancelDocument' => 
    array (size=2)
      'version' => string '11.1' (length=4)
      'wsdl' => string 'dc22e4ee' (length=8)
  'Ticket_CheckEligibility' => 
    array (size=2)
      'version' => string '13.1' (length=4)
      'wsdl' => string 'dc22e4ee' (length=8)
  'Ticket_CreateTSMFareElement' => 
    array (size=2)
      'version' => string '10.1' (length=4)
      'wsdl' => string 'dc22e4ee' (length=8)
  'Ticket_CreateTSMFromPricing' => 
    array (size=2)
      'version' => string '9.1' (length=3)
      'wsdl' => string 'dc22e4ee' (length=8)
  'Ticket_CreateTSTFromPricing' => 
    array (size=2)
      'version' => string '4.1' (length=3)
      'wsdl' => string 'dc22e4ee' (length=8)
  'Ticket_DisplayTSMP' => 
    array (size=2)
      'version' => string '13.1' (length=4)
      'wsdl' => string 'dc22e4ee' (length=8)
  'Ticket_DisplayTST' => 
    array (size=2)
      'version' => string '15.1' (length=4)
      'wsdl' => string 'dc22e4ee' (length=8)
  'Ticket_ProcessETicket' => 
    array (size=2)
      'version' => string '4.1' (length=3)
      'wsdl' => string 'dc22e4ee' (length=8)
  'Ticket_ReissueConfirmedPricing' => 
    array (size=2)
      'version' => string '13.2' (length=4)
      'wsdl' => string 'dc22e4ee' (length=8)
  'Ticket_RepricePNRWithBookingClass' => 
    array (size=2)
      'version' => string '14.3' (length=4)
      'wsdl' => string 'dc22e4ee' (length=8)

@bimusiek
Copy link
Collaborator Author

While printing directly in Conv:

var_dump($version);
var_dump(floatval($version) < floatval(13));
/var/www/html/vendor/amabnl/amadeus-ws-client/src/Amadeus/Client/RequestCreator/Converter/Fare/PricePNRWithBookingClassConv.php:44:
array (size=2)
  'version' => string '14.1' (length=4)
  'wsdl' => string 'dc22e4ee' (length=8)
/var/www/html/vendor/amabnl/amadeus-ws-client/src/Amadeus/Client/RequestCreator/Converter/Fare/PricePNRWithBookingClassConv.php:45:boolean true

@DerMika
Copy link
Collaborator

DerMika commented Apr 27, 2017

Wait, are you getting an array as $version???

@DerMika
Copy link
Collaborator

DerMika commented Apr 27, 2017

Ok, that sounds like a dumb mistake on my part :)

@bimusiek
Copy link
Collaborator Author

Yes :(

Changing it to if (floatval($version['version']) < floatval(13)) { helped but I guess it should not get array here.

@DerMika
Copy link
Collaborator

DerMika commented Apr 27, 2017

Ok, It'll be fixed tonight, but it'll require some work on the unittests. Hang in there - and thanks for finding this bug!

@DerMika DerMika added the bug label Apr 27, 2017
@DerMika DerMika changed the title Bug after updating to newest master Error recognizing message versions in Request Creator Apr 27, 2017
@bimusiek
Copy link
Collaborator Author

Thanks for help. I am in no hurry as I just patched it directly in container so I can work with this patch for now.

@DerMika
Copy link
Collaborator

DerMika commented Apr 27, 2017

This should be fixed now. Please test! :)

@bimusiek
Copy link
Collaborator Author

Works ❤️ Thanks!

@DerMika DerMika closed this as completed Apr 28, 2017
@DerMika DerMika added this to the 1.4.0 milestone Nov 6, 2017
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