Menu

#1296 XSD Element extension gives warning in wsdl2h and error in soapcpp2

v1.0 (example)
closed-fixed
None
5
2021-08-19
2021-06-11
Darren
No

I'm working on IATA NDC schemas (v18.1 from here - https://www.iata.org/en/programs/airline-distribution/ndc/download-form/) and have an issue when trying to use wsdl2h and soapcpp2 to generate c++ files. I've attached the main xsd and another xsd included by it. I'm using gsoap_2.8.77 from a legacy project.

It looks like in some cases when an element is defined with an extension, wsdl2h generates a class member which misses a namespace prefix (with a warning). Soapcpp2 then fails to create the data binding implementation files because the type is incomplete.

Commands I'm using:

  • wsdl2h -O3 -o intermediate_airshoppingRQ.h AirShoppingRQ.xsd -q AirShoppingRQ18_1
  • soapcpp2 intermediate_airshoppingRQ.h

Result I see:

In wsdl2h output (with verbose flag)
Warning: undefined QName "":FlightNumberType for type FlightNumberType in namespace "?"

In soapcpp2 output
intermediate_airshoppingRQ.h(40907): Syntax error: incomplete type in declaration of '__item'
....(skipping similar errors for other types)
Critical error: too many syntactic errors, bailing out

Looking at one specific example FlightNumberType (based on the line number above) I found in the interface definition header file (intermediate_airshoppingRQ.h): There's an undefined QName warning for the FlightNumberType so it seems to miss the namespace prefix "ns1__"

/// @brief Top-level root element "http://www.iata.org/IATA/2015/00/2018.1/AirShoppingRQ":FlightNumber
/// <PRE><BLOCKQUOTE>
///   Flight Number. Example: 1234, or OPEN, or ARNK
/// </BLOCKQUOTE></PRE>
///
/// @brief "http://www.iata.org/IATA/2015/00/2018.1/AirShoppingRQ":FlightNumber is a complexType with simpleContent extension of type "":FlightNumberType.
///
class _ns1__FlightNumber
{ public:
/// __item wraps simpleContent of type "":FlightNumberType.

/// @todo !FIXME! @warning Undefined QName "":FlightNumberType for type FlightNumberType in namespace "?", check WSDL and schema definitions.
    FlightNumberType                     __item                        ;
/// <PRE><BLOCKQUOTE>
///   Flight Operational Suffix
/// </BLOCKQUOTE></PRE>
///
@/// Length of this content is 1.
/// Content pattern is "[A-Z]".
    std::string                                                        
                                        *OperationalSuffix              0;  ///< Optional attribute.
/// Pointer to soap context that manages this instance
    struct soap                         *soap                          ;
};

I found another use of this FlightNumberType which does have the required prefix:

/// <PRE><BLOCKQUOTE>
///   This field contains the flight number of the Reservation Change (Marketing Carrier) flight.
/// </BLOCKQUOTE></PRE>
///
    class _ns1__CouponInfoType_ResFlightNumber
    { public:
/// __item wraps simpleContent of type "":FlightNumberType.
    ns1__FlightNumberType                __item                        ;
    }                                   *ResFlightNumber                0;  ///< Optional element.

From the xsd files attached I looked at the definitions of FlightNumberType and the elements extending it FlightNumber (failing) and ResFlightNumber (working)

<xsd:simpleType name="FlightNumberType">
  <xsd:annotation>
    <xsd:documentation xml:lang="en">Identifies a flight number (1 to 4 numbers) or OPEN or ARNK.</xsd:documentation>
  </xsd:annotation>
  <xsd:union>
    <xsd:simpleType>
      <xsd:restriction base="xsd:string">
        <xsd:pattern value="[0-9]{1,4}"/>
      </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType>
      <xsd:restriction base="xsd:string">
        <xsd:enumeration value="OPEN">
          <xsd:annotation>
            <xsd:documentation xml:lang="en">Used in lieu of a flight number when a specific flight number is unknown but service is present.</xsd:documentation>
          </xsd:annotation>
        </xsd:enumeration>
        <xsd:enumeration value="ARNK">
          <xsd:annotation>
            <xsd:documentation xml:lang="en">Used in lieu of a flight number when surface transportation is used when there is a break in the continuity of the flight itinerary.</xsd:documentation>
          </xsd:annotation>
        </xsd:enumeration>
      </xsd:restriction>
    </xsd:simpleType>
  </xsd:union>
</xsd:simpleType>

<xsd:element name="FlightNumber">
  <xsd:annotation>
    <xsd:documentation source="description" xml:lang="en">Flight Number. Example: 1234, or OPEN, or ARNK</xsd:documentation>
  </xsd:annotation>
  <xsd:complexType>
    <xsd:simpleContent>
      <xsd:extension base="FlightNumberType">
        <xsd:attribute name="OperationalSuffix">
          <xsd:annotation>
            <xsd:documentation>Flight Operational Suffix</xsd:documentation>
          </xsd:annotation>
          <xsd:simpleType>
            <xsd:restriction base="xsd:string">
              <xsd:length value="1"/>
              <xsd:pattern value="[A-Z]"/>
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:attribute>
      </xsd:extension>
    </xsd:simpleContent>
  </xsd:complexType>
</xsd:element>

<xsd:element name="ResFlightNumber" minOccurs="0">
  <xsd:annotation>
    <xsd:documentation>This field contains the flight number of the “Reservation Change” (Marketing Carrier) flight.</xsd:documentation>
  </xsd:annotation>
  <xsd:complexType>
    <xsd:simpleContent>
      <xsd:extension base="FlightNumberType"/>
    </xsd:simpleContent>
  </xsd:complexType>
</xsd:element>

If I manually edit the intermediate_airshoppingRQ.h definition file and add the ns1__, soapcpp2 generates the cpp files without issues.

Is there a known issue for this or is there something wrong in my approach? The schemas themselves seem to validate okay and they are official IATA NDC schemas.

2 Attachments

Discussion

  • Darren

    Darren - 2021-06-18

    Just to add I've reproduced with the latest 2.8.114 version of gSOAP with the same issue.

     
  • Robert van Engelen

    Thanks for sharing the details. To help out with your specific application, please submit support request tickets at www.genivia.com/contact.html. That will expedite assistance.

     
  • Robert van Engelen

    Sorry for the delay. Others have used gsoap with the IATA NDC schemas without problems, but perhaps that was a different set of schemas. Strange to see this issue with schema simpleType extensions, which produce the correct __itemmembers as expected but the namespace cannot be identified (it's an empty namespace), so ns1__ is missing here. I will take a look.

     
  • Robert van Engelen

    The fix for this issue will be included in the upcoming 2.8.117 update.

     
  • Robert van Engelen

    • status: open --> pending
    • assigned_to: Robert van Engelen
     
  • Robert van Engelen

    • status: pending --> closed-fixed
     
  • Robert van Engelen

    v2.8.117 is released.

     

Log in to post a comment.