php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77457 soap generated request does not work with <choice> tag
Submitted: 2019-01-14 11:48 UTC Modified: -
Votes:4
Avg. Score:4.2 ± 0.8
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:1 (33.3%)
From: nevermind dot cs96 at gmail dot com Assigned:
Status: Open Package: SOAP related
PHP Version: 7.1.26 OS: Ubuntu 16.04.5 LTS (GNU/Linux 4.
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: nevermind dot cs96 at gmail dot com
New email:
PHP Version: OS:

 

 [2019-01-14 11:48 UTC] nevermind dot cs96 at gmail dot com
Description:
------------
When all elements under <choice> tag has attribute minOccurs=0

Soap will only take first element to produce XML

probably related to https://bugs.php.net/bug.php?id=50997

And  [2012-07-20 13:33 UTC] jboffel at gmail dot com 's comment

Test script:
---------------
The passed in object
class utb\api\flight\travelport\Air\StructType\SearchAirLeg#253 (5) {
  public $SearchOrigin =>
  array(1) {
    [0] =>
    class utb\api\flight\travelport\Air\StructType\TypeSearchLocation#267 (6) {
      public $Airport =>
      NULL
      public $City =>
      class utb\api\flight\travelport\Air\StructType\City#268 (1) {
        public $Code =>
        string(3) "TPE"
      }
      public $CityOrAirport =>
      NULL
      public $CoordinateLocation =>
      NULL
      public $RailLocation =>
      NULL
      public $Distance =>
      NULL
    }
  }
  public $SearchDestination =>
  array(1) {
    [0] =>
    class utb\api\flight\travelport\Air\StructType\TypeSearchLocation#257 (6) {
      public $Airport =>
      class utb\api\flight\travelport\Air\StructType\Airport#262 (1) {
        public $Code =>
        string(3) "KIX"
      }
      public $City =>
      NULL
      public $CityOrAirport =>
      NULL
      public $CoordinateLocation =>
      NULL
      public $RailLocation =>
      NULL
      public $Distance =>
      NULL
    }
  }
  public $SearchDepTime =>
  array(1) {
    [0] =>
    class utb\api\flight\travelport\Air\StructType\TypeFlexibleTimeSpec#269 (4) {
      public $SearchExtraDays =>
      NULL
      public $TimeRange =>
      NULL
      public $SpecificTime =>
      NULL
      public $PreferredTime =>
      string(10) "2019-02-03"
    }
  }
  public $SearchArvTime =>
  array(0) {
  }
  public $AirLegModifiers =>
  NULL
}

WSDL <choice> part ( full schema https://support.travelport.com/webhelp/uapi/uAPI.htm#Getting_Started/Universal_API_Schemas_and_WSDLs.htm%3FTocPath%3DGetting%2520Started%7CGetting%2520Connected%7C_____2 )
<xs:complexType name="typeSearchLocation">
    <xs:sequence>
        <xs:choice>
            <xs:element ref="Airport" minOccurs="0"/>
            <xs:element ref="City" minOccurs="0"/>
            <xs:element ref="CityOrAirport" minOccurs="0"/>
            <xs:element ref="CoordinateLocation" minOccurs="0"/>
            <xs:element ref="RailLocation" minOccurs="0"/>
        </xs:choice>
        <xs:element ref="Distance" minOccurs="0"/>
    </xs:sequence>
</xs:complexType>

Expected result:
----------------
<ns2:SearchOrigin>
	<ns1:City Code="TPE"/>
</ns2:SearchOrigin>

Actual result:
--------------
<ns2:SearchOrigin/>

Which I'll get if I alter all the minOccurs to 1

Patches

Pull Requests

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC