2
votes

Using Delphi 2007 I am trying to import an wsdl for client-side use.

I have imported the WSDL at https://services.rdc.nl/voertuigscan/2.0/wsdl, which imports an xsd to define it's types. In the imported xsd, there are several additional imported and included xsd's, among which is defined the following type:

<xs:complexType name="BedragExtended">
  <xs:simpleContent>
    <xs:extension base="ct:Bedrag">
      <xs:attribute name="Bron" type="Bron"/>
    </xs:extension>
  </xs:simpleContent>
</xs:complexType>

The type ct:Bedrag is defined in an included XSD as:

<xs:simpleType name="Bedrag">
  <xs:restriction base="xs:decimal">
    <xs:totalDigits value="9"/>
    <xs:fractionDigits value="2"/>
  </xs:restriction>
</xs:simpleType>

However, the BedragExtended type is imported as:

// ************************************************************************ //
// XML       : BedragExtended, global, <complexType>
// Namespace : http://nsp.rdc.nl/RDC/voertuigscan
// ************************************************************************ //
BedragExtended = class(TRemotable)
private
  FBron: Bron;
  FBron_Specified: boolean;
  procedure SetBron(Index: Integer; const ABron: Bron);
  function  Bron_Specified(Index: Integer): boolean;
published
  property Bron: Bron  Index (IS_ATTR or IS_OPTN) read FBron write SetBron stored Bron_Specified;
end;

As you can see, there's no mention the underlying value of the Bedrag type, yet the header at the top of the .pas file generated by the wsdl import shows the correct xsd's have been parsed. How can I get Delphi to correctly generate the BedragExtended type?

1
Probably not related, but I had an error importing a WSDL and I had to resort to inline the file instead of including.Leonardo Herrera

1 Answers

0
votes

It is rather typical to see this behaviour in all languages (that I know of at least). A simple type is generally not mapped to a class. The only notable exception is for simple types that use the enumeration facet, in which case you may get a type safe enumeration (both Java and .NET).

This is somewhat expected since BedragExtended is meant to be a string with an attribute. Unfortunately, in XSD 1.0 you cannot both extend (to set the attribute) and restrict (to constrain the lexical space) at the same time, so it is quite common to see this implementation, which is a complex type (to get the attribute) but with a simple content (some sort of text basically).