Groups > Borland > Delphi web services WSDL > Re: D2007 WSDL Import VMware VI3 webservice ( class not generated )




D2007 WSDL Import VMware VI3 webservice ( class not
generated )

D2007 WSDL Import VMware VI3 webservice ( class not generated )
13 Apr 2007 02:53:34 -0700
I am trying to connect to VMware webservice but wsdl import doesnt
generate code for "TraversalSpec" class. It does for DynamicData and
SelectionSpec from the part of the wsdl posted.

I have other classes not imported correctly, but definitions are
similar to this one TraversalSpec class.

Full wsdl is 1MB I can post or email if someone is interested.


Thanks in advance.

------- Part of WSDL file ---------------------------------

         <complexType name="DynamicData">
            <sequence>
               <element name="dynamicType"
type="xsd:string"
minOccurs="0" />
               <element name="dynamicProperty"
type="vim2:DynamicProperty" minOccurs="0"
maxOccurs="unbounded" />
            </sequence>
         </complexType>

         <complexType name="SelectionSpec">
            <complexContent>
               <extension base="vim2:DynamicData">
                  <sequence>
                     <element name="name"
type="xsd:string"
minOccurs="0" />
                  </sequence>
               </extension>
            </complexContent>
         </complexType>

         <complexType name="TraversalSpec">
            <complexContent>
               <extension base="vim2:SelectionSpec">
                  <sequence>
                     <element name="type"
type="xsd:string" />
                     <element name="path"
type="xsd:string" />
                     <element name="skip"
type="xsd:boolean"
minOccurs="0" />
                     <element name="selectSet"
type="vim2:SelectionSpec" minOccurs="0"
maxOccurs="unbounded" />
                  </sequence>
               </extension>
            </complexContent>
         </complexType>

------- End of WSDL file ---------------------------------


-------- Delphi generated classes --------------------

  DatastoreCapability = class(DynamicData)
  private
    FdirectoryHierarchySupported: Boolean;
    FrawDiskMappingsSupported: Boolean;
    FperFileThinProvisioningSupported: Boolean;
  published
    property directoryHierarchySupported:      Boolean  read
FdirectoryHierarchySupported write FdirectoryHierarchySupported;
    property rawDiskMappingsSupported:         Boolean  read
FrawDiskMappingsSupported write FrawDiskMappingsSupported;
    property perFileThinProvisioningSupported: Boolean  read
FperFileThinProvisioningSupported write
FperFileThinProvisioningSupported;
  end;


  SelectionSpec = class(DynamicData)
  private
    Fname_: WideString;
    Fname__Specified: boolean;
    procedure Setname_(Index: Integer; const AWideString: WideString);
    function  name__Specified(Index: Integer): boolean;
  published
    property name_: WideString  Index (IS_OPTN) read Fname_ write
Setname_ stored name__Specified;
  end;

-------- End of Delphi generated classes --------------------
Post Reply
Re: D2007 WSDL Import VMware VI3 webservice ( class not generated )
13 Apr 2007 11:13:18 -0700
WSDL File at http://www.lostcreations.com/~akutz/pgadd.zip as vim.wsdl
Post Reply
Re: D2007 WSDL Import VMware VI3 webservice ( class not generated )
Sat, 14 Apr 2007 12:14:31 -070
Hello,

This is a problem that came up after D2007 and have addressed since.
Basically, with D2007 we added support to handle polymorphic XML types
(serializing a type derived from the one described in the Schema). However,
the importer still refrains to emit types that are not *used*. By 'used' I
mean types that are explicitly referred. In this case, TraversalSpec is
probably not explicitly referred to by other types or as parts of operations
because one can use a TraversalSpec anywhere a 'SelectionSpec' is expected.

There are many solutions:

#1 Tell the importer to emit all types, whether they are used or not. You
can do this with the -Ot+ switch (WSDLIMP) or by turning off the 'Do not
emit unused types' option in the IDE's Options|OtherOptions from the WSDL
Import wizard.

#2. Since the source code to the WSDL Importer is now included with the
product, you can rebuild it after updated the TWSDLType.GetIsUsed method:

    function TWSDLType.GetIsUsed: Boolean;
    begin
      Result := FIsUsed;

      { NOTE: Headers and Fault types are always used }
      if (not Result) and ((FTypeFlag = wfHeader) or (FTypeFlag = wfFault))
then
      begin
        SetIsUsed(True);
        Result := True;
      end;

      { To support polymorphism, classes are used if their base type is
used }
      if (not Result) and ((FDataKind = wtClass) and
                           (FBaseType <> nil) and
                           (FBaseType.IsUsed)) then
      begin
        SetIsUsed(True);
        Result := True;
      end;
    end;

#3 Or I can email you an update to the importer that has the above fix. The
importer also contains a few other things. So I would caution you about this
approach as (depending on what features the WSDL uses), you may also need a
new runtime to support what the importer generates [mainly regarding
mixed="true" and xsd:any types].


Let me know if you opt for #3. #1 is probably the easiest.

Cheers,

Bruneau.

Post Reply
Re: D2007 WSDL Import VMware VI3 webservice ( class not generated )
17 Apr 2007 03:00:53 -0700
The problem I have now is that after calling a method
( RetreiveProperties ) I get an Array_Of_ObjectContent. Each element
in this array has a refefence to an ArrayOfDinamicProperties. In my
example I am retriving to properties "name" and "parent" for
each
object. I can read name value but cant access parent value ( that
should be a reference to a ManagedObjectReference ) as it is returned
as VarEmpty. If I try to typecast Variant as ManagedObjectReference(V)
delphi complains about invalid typecast.

I am not sure if the problem is my code or wsdl importer generating
bad code. How can I debug it?

Post Reply
Re: D2007 WSDL Import VMware VI3 webservice ( class not generated )
18 Apr 2007 01:16:53 -0700
What I get is an array of DynamicProperty:

--- WSDL ---

         <complexType name="DynamicProperty">
            <sequence>
               <element name="name" type="xsd:string"
/>
               <element name="val" type="xsd:anyType"
/>
            </sequence>
         </complexType>


---- DELPHI class ----

 DynamicProperty = class(TRemotable)
  private
    Fname_: WideString;
    Fval: Variant;
  published
    property name_: WideString  read Fname_ write Fname_;
    property val:   Variant     read Fval write Fval;
  end;

  ArrayOfDynamicProperty = array of DynamicProperty;
{ "urn:vim2"[GblCplx] }



I can read and print name property for all elements in the array but I
can only read "val" for elements in the arrays that return this value
as string. If val is and object I cant cast it to my own DataType. I
should be able to cast it as ManagedObjectReference.

var
dp:DynamicProperty
...
ManagedObjectReference(dp.val);

Error: E2089 Invalid typecast



If I cast it as ArrayOfManagedObjectReference(dp.val) I dont get any
error but doesnt seem to work.

why does it let me cast the variant as an object and not as the other?

Post Reply
<< Previous 1 2 Next >>
( Page 1 of 2 )
about | contact