[Fedora-suds-list] Failed to construct the parameter to use VMWare ESXi function.

Jeff Ortel jortel at redhat.com
Wed Mar 3 14:59:15 UTC 2010


Hey Leslie,

This is a known limitation in suds.  Attributes with leading (_) are deemed to be 
attributes.  I know, it's not the best convention but has worked pretty well since the 
beginning :)

I probably need to either:

1) make the (_) special char configurable
2) provide for an exception list
3) make allow for escaping with (__).

I like #3 the best.  I'll look into it.

Regards,

Jeff

On 03/02/2010 11:43 PM, Leslie Rong wrote:
> Hi, all,
> I am the beginner to use suds.
> Now I encoutnter one problem when using suds to send operation request
> to VMWare VSphere Server.  May I get your help on this issue.
> I couldnt' use suds to construct the argument to be used by VMWare ESX
> functton "*RetrieveServiceContent". *
> **
> The parameter xml should be "<_this
> type="ServiceInstance">ServiceInstance</_this>".
> How can I use suds to construct this kind of function parameter?
> I pasted my script, error output, wsdl.  Here
> ~~~~~~~~~~~~~~~~~~~~-Python Script
> begin-------------------------------------------------------------
> url = 'https://10.204.211.1/sdk/vimService.wsdl'
> #start(url)
> client = Client(url)
> #print client
> client.set_options(location='https://10.204.211.1/sdk')
> mor=client.factory.create('ns0:ManagedObjectReference')
> mor._type='ServiceInstance'
> _sjc=client.service.RetrieveServiceContent(mor)
> print _sjc
> ~~~~~~~~~~~~~~~~~~~~Python script end~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ~~~~~~~~~~~~~~~~~~~~Error Msg begin~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> (ManagedObjectReference){
>     _type = ""
>   }
> DEBUG:suds.client:sending to (https://10.204.211.1/sdk)
> message:
> <SOAP-ENV:Envelope xmlns:ns0="urn:vim25"
> xmlns:xsi="http://www.w3.org/2001/XMLSc
> hema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
> <SOAP-ENV:Header/>
> <SOAP-ENV:Body>
> <ns0:RetrieveServiceContent>
> <ns0:_this xsi:type="ServiceInstance"/>
> </ns0:RetrieveServiceContent>
> </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
> DEBUG:suds.client:headers = {'SOAPAction': u'"urn:vim25/4.0"',
> 'Content-Type': '
> text/xml'}
> ERROR:suds.client:<?xml version="1.0" encoding="UTF-8"?>
> <SOAP-ENV:Envelope xmlns:ns0="urn:vim25"
> xmlns:xsi="http://www.w3.org/2001/XMLSc
> hema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
> <SOAP-ENV:Header/>
> <SOAP-ENV:Body>
> <ns0:RetrieveServiceContent>
> <ns0:_this xsi:type="ServiceInstance"/>
> </ns0:RetrieveServiceContent>
> </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
> DEBUG:suds.client:http failed:
> <?xml version="1.0" encoding="UTF-8"?>
> <soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
>   xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
>   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <soapenv:Body>
> <soapenv:Fault><faultcode>ServerFaultCode</faultcode><faultstring>type</faultstr
> ing><detail><InvalidRequestFault xmlns="urn:vim25"
> xsi:type="InvalidRequest"></I
> nvalidRequestFault></detail></soapenv:Fault>
> </soapenv:Body>
> </soapenv:Envelope>
> Traceback (most recent call last):
>    File "C:\Project\wsdl\test.py", line 42, in <module>
>      _sjc=client.service.RetrieveServiceContent(mor)
>    File
> "C:\Python26\lib\site-packages\suds-0.3.8-py2.6.egg\suds\client.py", line
>   537, in __call__
>      return client.invoke(args, kwargs)
>    File
> "C:\Python26\lib\site-packages\suds-0.3.8-py2.6.egg\suds\client.py", line
>   597, in invoke
>      result = self.send(msg)
>    File
> "C:\Python26\lib\site-packages\suds-0.3.8-py2.6.egg\suds\client.py", line
>   632, in send
>      result = self.failed(binding, e)
>    File
> "C:\Python26\lib\site-packages\suds-0.3.8-py2.6.egg\suds\client.py", line
>   683, in failed
>      r, p = binding.get_fault(reply)
>    File
> "C:\Python26\lib\site-packages\suds-0.3.8-py2.6.egg\suds\bindings\binding
> .py", line 235, in get_fault
>      raise WebFault(p, faultroot)
> suds.WebFault: Server raised fault: 'type'
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ---------------------------------------------------------------------------------------
> ----------------------------------------WSDL -
> ManagedObjectReference-------------------------------------
> *-* <https://10.204.211.1/sdk/vim.wsdl#> <complexType
> name="*ManagedObjectReference*">
> *-* <https://10.204.211.1/sdk/vim.wsdl#> <simpleContent>
> *-* <https://10.204.211.1/sdk/vim.wsdl#> <extension base="*xsd:string*">
> * * <attribute name="*type*" type="*xsd:string*" />
> * * </extension>
> * * </simpleContent>
> * * </complexType>
> ----------------------------------------------------------------------------------------------------------------------------
> ------------------------------------- WSDL -Function
> *RetrieveServiceContent------------------------*
> *-* <https://10.204.211.1/sdk/vim.wsdl#> <complexType
> name="*RetrieveServiceContentRequestType*">
> *-* <https://10.204.211.1/sdk/vim.wsdl#> <sequence>
> * * <element name="*_this*" type="*vim25:ManagedObjectReference*" />
> * * </sequence>
> * * </complexType>
> * * <element name="*RetrieveServiceContent*"
> type="*vim25:RetrieveServiceContentRequestType*" />
> *-* <https://10.204.211.1/sdk/vim.wsdl#> <element
> name="*RetrieveServiceContentResponse*">
> *-* <https://10.204.211.1/sdk/vim.wsdl#> <complexType>
> *-* <https://10.204.211.1/sdk/vim.wsdl#> <sequence>
> * * <element name="*returnval*" type="*vim25:ServiceContent*" />
> * * </sequence>
> * * </complexType>
> * * </element>
> -------------------------------------------------------------------------------------------------------------
>
>
>
> _______________________________________________
> 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/20100303/9615f256/attachment-0001.bin 


More information about the suds mailing list