Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > SOAPpy and ArrayOfKeyValue

Reply
Thread Tools

SOAPpy and ArrayOfKeyValue

 
 
Alex Ezell
Guest
Posts: n/a
 
      10-09-2007
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
this:

def dictToKeyValue(self, mydict):
soap_list = []
for key,value in mydict.items():
inner = []
inner.append(SOAPpy.stringType(key,'key'))
inner.append(SOAPpy.stringType(value,'value'))
soap_list.append(SOAPpy.arrayType(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.

/alex
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: SOAPpy and ArrayOfKeyValue Alex Ezell Python 0 10-09-2007 10:26 PM
SOAPpy and .NET - Help Richard Kessler Python 1 11-03-2004 09:18 AM
SOAPpy and WSDL and basic authentication Vivek Python 0 08-04-2004 12:51 AM
Re: Trying to build exe with py2exe and SOAPPy Lyle Python 0 10-11-2003 05:59 AM
Trying to build exe with py2exe and SOAPPy Steven Bell Python 0 10-09-2003 03:02 AM



Advertisments