472,145 Members | 1,607 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,145 software developers and data experts.

SOAPpy and ArrayOfKeyValue

Can anyone offer any assistance as to how to convert a basic python
dictionary, list, or even tuple into the SOAP type "ArrayOfKeyValue"?

I am currently using SOAPpy, but would be willing to change to ZSI or
something else if it made this conversion easier.

I have tried with the arrayType and structType methods in
SOAPpy.Types, yet they don't seem to do what I need. I suspect there
might not be just a single method call, so, I wrote something like

def dictToKeyValue(self, mydict):
soap_list = []
for key,value in mydict.items():
inner = []
print soap_list
return SOAPpy.arrayType(soap_list)

As you can see, it's pretty nasty and doesn't do what I need either. I
have a client that was written in PHP which I am converting. It uses
this function (which calls the PEAR SOAP library):

function assocArrayToKeyValue($array) {
$soap_array = array();
foreach($array as $key=>$value) {
$inner = array();
$inner[] =& new SOAP_Value('key', 'string', $key);
$inner[] =& new SOAP_Value('value', 'string', $value);
$soap_array[] =& new SOAP_Value("item",
"{{$this->wsdl_urn}}KeyValue", $inner);
return $soap_array;

Unfortunately, I don't really have a way to see exactly what
$soap_array is so that I could emulate it in my Python code.

Any pointers or suggestions are very much appreciated.

Oct 9 '07 #1
0 1031

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Vivek | last post: by
reply views Thread by Harry George | last post: by
reply views Thread by elsarfhem | last post: by
reply views Thread by Sameer Deshpande | last post: by
reply views Thread by benboals | last post: by
reply views Thread by linuxprog | last post: by
reply views Thread by pion | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.