Hi All,
I am receiving a hash below from my Soap Interface
<SOAPpy.Types.structType item at 34661160>: {'Field12value': ':C
F3Value', 'Field8': 'Price Text:price_text', 'Field9': 'Text with
File:file_text
', 'Field11value': ':CF2Value', 'Field7': 'Product Code:product_code',
'Field7va
lue': ':product_values', 'Field2': 'Job Reference:job_reference', 'Field3':
'Job
Description:job_description', 'Field6': 'Campaign Name:campaign_name',
'Field10
value': ':CF1Value', 'Field6value': ':campaign_values', 'Field5':
'Keywords:keyw
ords', 'Field10': 'CF1Title:custom_field1', 'Field11':
'CF2Title:custom_field2',
'Field12': 'CF3Title:custom_field3', 'Field13': 'CF4Title:custom_field4',
'Fiel
d14': 'Name:meta_filename', 'Field4': 'Display Name:display_name',
'Field13value
': ':CF4Value'}
How can i iterarte through it bcz when do try do something like
myHash.values()
I am getting the error
AttributeError: structType instance has no attribute 'values'
any help
Thomas 2 4171
Thomas Thomas schrieb: Hi All,
I am receiving a hash below from my Soap Interface
<SOAPpy.Types.structType item at 34661160>: {'Field12value': ':C F3Value', 'Field8': 'Price Text:price_text', 'Field9': 'Text with File:file_text ', 'Field11value': ':CF2Value', 'Field7': 'Product Code:product_code', 'Field7va lue': ':product_values', 'Field2': 'Job Reference:job_reference', 'Field3': 'Job Description:job_description', 'Field6': 'Campaign Name:campaign_name', 'Field10 value': ':CF1Value', 'Field6value': ':campaign_values', 'Field5': 'Keywords:keyw ords', 'Field10': 'CF1Title:custom_field1', 'Field11': 'CF2Title:custom_field2', 'Field12': 'CF3Title:custom_field3', 'Field13': 'CF4Title:custom_field4', 'Fiel d14': 'Name:meta_filename', 'Field4': 'Display Name:display_name', 'Field13value ': ':CF4Value'}
How can i iterarte through it bcz when do try do something like myHash.values() I am getting the error AttributeError: structType instance has no attribute 'values'
That is because it is no hash - AFAIK SOAP doesn't support hashes (or
dicts, in python-lingo) out of the box. What you see above essentially a
named tuple. Conceptionally like this:
class MyStruct:
def __init__(self, foo, bar):
self.foo = foo
self.bar = bar
Either you access the individual values by name - or maybe there is a
way to enumerate the names for you, but that depends on what the
SOAPpy.Types.structType is capable of. I suggest you look at it's source.
Diez
On 5/10/06, Diez B. Roggisch <de***@nospam.web.de> wrote: That is because it is no hash - AFAIK SOAP doesn't support hashes (or dicts, in python-lingo) out of the box. What you see above essentially a named tuple. Conceptionally like this:
class MyStruct:
def __init__(self, foo, bar): self.foo = foo self.bar = bar
Either you access the individual values by name - or maybe there is a way to enumerate the names for you, but that depends on what the SOAPpy.Types.structType is capable of. I suggest you look at it's source.
IIRC, SOAPpy's structType has a _keys() function - so somethign like
the following (untested) might work:
struct_as_a_dict = dict((key, getattr(struct, key)) for key in struct._keys())
--
Cheers,
Simon B, si***@brunningonline.net, http://www.brunningonline.net/simon/blog/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Russell |
last post by:
Using Python 2.3 and ZSI 1.2 I am having problems getting information
back from a test web service running on a PC on our LAN.
The SOAP request details (from the .asmxfile) are as follows:
...
|
by: Marc van Boven |
last post by:
I'm stuck with the following problem:
My nusoap-client calls a server-function giveCombination(). The
function giveCombination should return something like
array(
=> array(
'a_id' => 6,...
|
by: Artur |
last post by:
Hi Newsgroup,
im currently working on programming a asp.net application consuming an
Webservice hosted on Apache/Axis. I have generated WSDL and Proxy
classes from VisualStudio.net. But when...
|
by: Leonid |
last post by:
Hello,
Please help me to resolve next problem: I have Web service
installed on the network and I can communicate with it via
WSDL file from several applications including VC++6
application...
|
by: Jonathan |
last post by:
Hi there, I am using a LOTUS/DOMINO Web Service in my ASP.Net
application and I am having quite a lot of problems. I have managed to
solve most of them but this one it really is giving me terrible...
|
by: Jonathan [sbrodolo] |
last post by:
Hi there, I am using a LOTUS/DOMINO Web Service in my ASP.Net application and
I am having quite a lot of problems. I have managed to solve most of them but
this one it really is giving me terrible...
|
by: systemutvecklare |
last post by:
Hi
I can't find out how to send an array of objects with the built in SOAP
in PHP5.
My code looks like this:
****BEGIN CODE****
$id = new GuidVO();
$ids = array($id);
$soap_param = new...
|
by: Matthew |
last post by:
Using .NET 1.1 I trying to consume a web service that returns an integer and
an array of type string which I declare and use line this
Dim Results() As String
Me.txtMain.Text =...
|
by: IanWright |
last post by:
I'm trying to extend an existing soap webservice by adding in a couple of new methods, however I'm having a problem in getting the client to run the method calls and I'm not sure why.
I've not had...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |