Talk:WSDLIMP.EXE, the Command Line WSDL Import Tool

From RAD Studio
Jump to: navigation, search

For XE/Update there's a new WSDLImp option:

 -Or-   Generate alias for the element of pure collections


It's a backward compatible switch to generate code as previous versions did. For example, let's 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 would generate 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;

The type 'hawk', an alias of string, represents the element 'hawk' and encoded the name to be used for elements of the earie 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;

And the way the name of the array element is preserved is 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.


Response

Many thanks for your complete information! I have added a small separate topic to describe the WSDL -Or- Option.

KrisHouser 17:20, 23 November 2010 (PST)