473,406 Members | 2,619 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Reading Soap struct type

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

May 10 '06 #1
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
May 10 '06 #2
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/
May 10 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
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: ...
0
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,...
2
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...
0
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...
0
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...
4
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...
0
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...
1
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 =...
4
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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
0
BarryA
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...
0
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...
0
marktang
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,...
0
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...
0
Oralloy
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,...
0
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...
0
agi2029
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,...

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.