[Fedora-suds-list] Setting Value of Extension of types

Jeff Ortel jortel at redhat.com
Thu Apr 15 13:07:19 UTC 2010


Hey Garth:

On 04/15/2010 07:11 AM, Garth Bushell wrote:
> Hi,
>
> I'm Fairly new to using SOAP so this may be stupid but..

Nah, see below.

>
> There is a type in the Vware Vim api[1] defined as an extension of
> xsd:string as below.
>
> <complexType name="ManagedObjectReference">
>    <simpleContent>
>      <extension base="xsd:string">
>        <attribute name="type" type="xsd:string"/>
>      </extension>
>    </simpleContent>
> </complexType>
>
> I believe it is extending the type String and adding an attribute called "type".
>
> Within the Java and C# SOAP wrappers these generate a class with two attributes
>   "type" from ManagedObjectReference and "value" from xsd:string.
>
> The Suds call "mor=client.factory.create('ns0:ManagedObjectReference')"
> generates a
>   object but it seems to be missing the value attribute.

I believe the factory (based on the schema) will create and return a 
suds.sudsobject.Property object which has a 'value' attribute that is not in the keylist. 
  Try setting the value and type as:

 > mor._type = 'foo'
 > mor.value = 'bar'

and then:

 > print mor
(Property){
    value = "foo"
    _type = "bar"
  }

Is this true in your case?

Simple types that have attributes are quite rare and the Property class was developed for 
exactly this case.

hope this helps,

Jeff

>
>>>> print mor.__keylist__
> ['_type']
>
> How do I set the value of the xsd:string of the ManagedObjectReference
> within suds?
>
> as I can only set the type not the value of the xs:string I'm extending.
>
> Hope this makes sense.
>
> Cheers
>
> Garth
>
>
> [1] - http://www.vmware.com/support/developer/vc-sdk/
> _______________________________________________
> suds mailing list
> suds at lists.fedoraproject.org
> https://admin.fedoraproject.org/mailman/listinfo/suds

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5126 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.fedoraproject.org/pipermail/suds/attachments/20100415/4a51f30c/attachment.bin 


More information about the suds mailing list