WSDL -Or- Option

From RAD Studio
Jump to: navigation, search

Go Up to WSDLIMP.EXE, the Command Line WSDL Import Tool


The -Or- option is defined as Generate alias for the element of pure collections. It is a backward-compatible switch to generate code as previous versions did. For example, take a look at a pure collection type:

	  <complexType name="aerie">
	    <element name="hawk" type="xs:string" maxOccurs="unbounded"/>
	  </complexType>
	  
	  <complexType name="raptorInfo">
	    <element name="Hawks" type="tns:aerie"/>
	  </complexType>


Previous versions of WSDLImp generated the following Delphi code for the above types:

  hawk       = string;         { "urn:test:ns"[!U][Alias] }
  aerie      = array of hawk;  { "urn:test:ns"[!U][GblCplx] }

  raptorInfo = class(TRemotable)
  private
    FHawks: aerie;
  published
    property Hawks: aerie  read FHawks write FHawks;
  end;

In this example, the type 'hawk', an alias of string, represents the element 'hawk' and it encoded the name to be used for elements of the aerie array/collection.

Now WSDLImp merely generates:

  aerie      = array of string;                 { "urn:test:ns"[!U][GblCplx] }

  raptorInfo = class(TRemotable)
  private
    FHawks: aerie;
  published
    property Hawks: aerie  read FHawks write FHawks;
  end;

The name of the array element is preserved via the 'RegisterExternalPropName' call:

  RemClassRegistry.RegisterExternalPropName(TypeInfo(raptorInfo), 'Hawks', '[ArrayItemName="hawk"]');


If you want to reenable the generation of an alias type as before, turn ON the "Generate alias for the element of pure collections" option. It's OFF by default.