suds not building complex types correctly
by Jeremy Boyd
Hi all,
I'm trying to use suds to consume a WSDL and use a vendor's service. I've found that things work pretty well unless I need to get a complex argument as a response. The WSDL defines a type ArrayOfInt as follows:
<complexType name="ArrayOfInt">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType" wsdl:arrayType="soapenc:int[]" />
</restriction>
</complexContent>
</complexType>
A typical request/response using ArrayOfInt might look something like this:
>>> client.service.getUserDeviceList(test_settings.username, test_settings.password, 41768)
83133
Here's the raw XML from that response:
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<getUserDeviceListResponse xmlns="https://www.roamsecure.net/Roamalert">
<s-gensym3 xsi:type="xsd:int">83133</s-gensym3>
<s-gensym5 xsi:type="xsd:int">83134</sgensym5>
</getUserDeviceListResponse>
</soap:Body>
</soap:Envelope>
The trouble I'm having is that suds is failing to convert this response into an ArrayOfInt. It only gives me the first number - e.g. 83133. And the type of the result, per suds, is 'int', so it's not like it's creating an ArrayOfInt with only 1 element.
Is there something I should be doing to get an ArrayOfInt out of this response?
Thanks.
--
Jeremy Boyd
e: boydjj(a)gmail.com
c: (512) 586-4587
12 years, 6 months
For Sale:Stork 6TM410 Main Engine 4000HP-550RPM-Pielstick 12PC2.5 Main Engine 7800PS 520 rpm
by Engine Stocklist
22-02-2010
Dear Sir Good Days !!!!!
Our Company Buying all kind of Vessels For Demolition with Cash Payment. If you have any vessel for scrap please let us the particulars and we will offer the best market price.
Fallowing the items are ready for export.
*******************************
MAK 6M 43C NEW MARINE ENGINE YEAR OF BUILD 2008- 6000 KW -500 RPM
GEAR BOX, CPP, BOW THRUSTER AVAILABLE
*************************************
STORK WERKSPOOR 6TM 410 C LL 4000 HP 540 RPM
STORK WERKSPOOR 6TM410 B Main Engine 4000 hp 550 rpm
MIRRLEES BLACKSTONE K6MAJOR MAIN ENGINE 3300 HP 550 RPM
2PCS BERGEN KVMB16 MAIN ENGINES IN GOOD CONDITION 2200KW 825 RPM
Deutz 16M 816 Marine Engine With Gear Box 1800 HP 1800 RPM
DEUTZ 12M 816 MARINE DIESEL ENGINE
Hanshin 6LU54 Main Engine 4500 HP 230 RPM
HANSHIN 6LU35 1800 PS 320 RPM
BERGEN LDM9 1435 HP 750 RPM
SKL 6NVD 26A-2 MARINE ENGINE
MWM RHS 518-S 175 RPM 1200 HP MARINE ENGINE
DEUTZ 8M 628 MAIN ENGINE YEAR OF BUILD 2000 1324KW 750RPM
MTU MB 12V 652 MARINE ENGINES 800 PS 1500 RPM
CREPELLE 4SN3L MARINE ENGINES 512 KW 750 RPM
DEUTZ SBV 6M 540 MAIN ENGINE 1471 KW 600 RPM
DEUTZ BA 6M816 279 KW 1500 RPM 380V 281 KVA 50 HZ MARINE GENSET 2 PCS VERY GOOD CONDITION
VOLVO PENTA TMD 120AK
VOLVO PENTA TAMD 162C MD
NOHAB POLAR F212V 1850 HP 750 RPM MARINE ENGINE 2 PCS
Cat 3512 Marine Engine With CPP Control System and Bureau Veritas Class and EIAPP Certificate
Year of build is 2005 only 300 Hours Used
WARTSILA 12V32E USED CYL HEADS:48 PCS
WARTSILA 12V46C USED CYL HEADS:40 PCS(YEAR OF MANUFACT 2005)
WARTSILA 12V46C USED CYL LINER: 36 PCS(YEAR OF MANUFACT.2005)
WARTSILA 12V46C USED PISTON COMPLETE:38 PCS(YEAR OF MANUFACT.2005
STD SIZE-MAHLE TYPE)
WARTSILA 12V46C USED PISTON PIN
WARTSILA 12V46C USED CON ROD UPPER PART:36 PCS
WARTSILA 12V46C USED CAM SHAFT SECTION :A BANK 3 SET-B BANK 3 SET
2 x SKL 8VD 36/24 A-1 Genset
2 x SKL 6VDS 48/42 Al-2
2 x SKL 6 NVD 48 A2U
DEUTZ BV 12M 628 GENSET 2225 KVA 60 HZ/720 RPM 440V
-------------------------------------------------------
DEUTZ SBV 6M 628 1276 KW 900 RPM 1993 BUILD
------------------------------------------------------------
DEUTZ RBV 8M 545 MAIN ENGINE
DEUTZ RBV 6M 545 MAIN ENGINE
MAN B&W 6L28/32 GOOD CONDITION GENSET BUILT 1987 1260 KW 720 RPM 1500 KVA 60 HZ
B&W 6S28LH-4 1050 HP 720 RPM Gensets Built 1983
B&W 8T23LH Marine Gensets
SEMT PIELSTICK 12PC 2.5V MAIN ENGINE 2 PCS WITH GEAR BOX 7800 PS 520 RPM
B&W 7L35MC Piston, Liner, Cyl Head , Con Rod
B&W 8L55GFC Secondhand and New Spares Piston, Liner, Cyl Head , Con Rod, and many items....
CATERPILLAR 3508 B 2002 MODEL MARINE GENSET 60 hz
CATERPILLAR 3512B GENSET 60 HZ 1910 bhp 1300 kw year of manufacure: 2003
CATERPILLAR 3512 MAIN ENGINE 2000 MODEL WITH GEAR BOX
MAX. ADV. POWER 968 kW 1298 HP MAX. RATED SPEED 1800 RPM MAX. LOW IDLE SPEED 1450 RPM
------------------------------------------------------------
SULZER 6AL 25/30 MARINE GENSET Excellent Condition 60 HZ 800 KVA 3 SET AVAILABLE
WICHMANN TYPE 5 AX 1250 HP 375 RPM COMPLETE ENGINE
SULZER NEW 6 ASL 25/30 CYL HEAD COMPLETE:10 PCS
SULZER NEW 6 AL 20/24 CRANK SHAFT :2 PCS
SULZER NEW 8AL 20/24 CRANK SHAFT :1 PC
SULZER NEW 8AL 25 CRANK SHAFT :2 PCS
SULZER NEW AL 20/24 CVYL HEAD /BARE:20 PCS
SULZER NEW AL 20/24 CYL LINER :85 PCS
SULZER 16ZV 40/48 STD SECONDHAND CRANKSHAFT : 1 pc
MAK 8M 551 AK USED CRANKSHAFT
SKL 6VD 26/20 AL-2 SECONDHAND STD CRANKSHAFT
DEUTZ 6M 358 USED CRANKSHAFT
DEUTZ 12M 350 10 PCS USED COMPLETE CYL HEAD AND 13 PCS LINER
SULZER RND 76 USED SPARE PARTS
CYL HEADS - PISTONS - CONNECTING RODS - LINERS ETC.....
DEUTZ 540 CYL HEADS NEW VERSION
PIELSTICK PC2.6 NEW CYL HEADS
-------------------------------------------
MAK 8MU 551 AK COMPLETE MAIN ENGINE 3000 PS 300 RPM
WARTSILA 4R22HF 590 KW 1000 RPM GEN SET
--------------------------------------------------------------
We have available for sale
MWM TBD 501 -8G MAIN ENGINES
MAN KAWASAKI K6Z 52/90N 6000 HP
B&W ALPHA 10V 23-U 720 RPM 880 HP
MAN BAZAN V8V 40/54 430 RPM 8900 HP Complete engine and Extra Crankshaft + Bedplate and block
B&W 6L45 GFCA 4350 KW 175 RPM COMPLETE MAIN ENGINE
B&W8L55GFC MAJOR PARTS
YANMAR 6GL-ST 60 HZ 875 KVA GENSETS GOOD CONDITION 4 PCS
DAIHATSU 6PSHTc 26D GENSET 840 PS 720 RPM 2 PCS
STORK TM410 MAJOR SPARE PARTS
CYL HEAD, LINER, PISTON, CON ROD
MAK LIST
MAK 552 AK SPARES
8 PCS USED PISTON
8 PCS USED COMPLETE CYL COVER
8 PCS USED CONNECTING ROD
8 PCS USED LINER
MAK 9M453AK USED PARTS
CRANK SHAFT+BLOCK+BEDPLEYT:1 PC
CAM SHAFT:1 PC
CYL HEAD COMPLETE:6 PCS
PUSH ROD :18 PCS
PISTON (4 RING GROOVES TYPE ):12 PCS
CON ROD :9 PCS
FUEL PUMP COMPLETE:9 PCS
LUB OIL PUMP:1 PC
TURBO CHARGER/AIR COOLER:1 PC
GAVARNOR COMPLETE:1 PC
MAK 601C New Cyl Head 1 PCS
MAK 551 AK 4 PCS Secondhand Cyl Heads
MAK 551 AK CON ROD 2 PCS One is NEW other is Secondhand
Deutz 628 Piston - Con Rod - Liner - Cyl Head - etc..
MIRLESS BLACK STONE K 8 MAJOR MK2 USED SPARES:
CYL HEAD COMPLETE 16 PCS
PISTON COMPLETE 9 PCS
CYL LINER 6 PCS
BEDPLATE +CRANK SHAFT :2 PCS
MAK 8M601AK List of Spares
Cylinder head bare 7 PCS
Piston complete 7 PCS
Piston pin 7 PCS
Connecting rod 7 PCS
Cylinder liner 3 PCS
Injection pump 8 PCS
Injection pump roller 8 PCS
Inlet roller 8 PCS
Exh. Roller 8 PCS
Injector 8 PCS
Starting valve 8 PCS
Valve cage bare-used 16 PCS
Valve cage bare-recond 10 PCS
Inlet valve-used 16 PCS
Exh valve-used 21 PCS
Rocker arm-complete 8 PCS
T/c vtr 600-s Complete 1 PCS
Camshaft-complete 1 PCS
Puch rod 16 PCS
Cyl liner lubricator-complete 1 PCS
Governor complete 1 PCS
Lube oil pump-complete 1 PCS
Piston crown-new original 2 PCS
Injection nozzle new 20 PCS
Main bearing pair-new 1 PAIR
Locating bearing new 1 PAIR
For More Information Please contact with us
We can supply many many items also if you have another inquiry please don t hesitate to contact with us
MTU 12V 2000 MAJOR PARTS
BEST REGARDS
www.shipowners.biz ( Please Click our web site for our contact details )
12 years, 7 months
problem receiving complex data
by Lorenz Martens
Hi List,
I'm quite new with python and SOAP / suds.
I have a local wsdl file which works fine with all functions giving back standard return values.
But when I try to get back a complex type it fails with :
DEBUG:suds.client:headers = {'SOAPAction': u'""', 'Content-Type': 'text/xml; charset=utf-8'}
DEBUG:suds.client:http succeeded:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="urn:vserver2.como.com">
<SOAP-ENV:Header></SOAP-ENV:Header>
<SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<ns1:getcpuinfoResponse>
<result xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cpuinfo[4]">
<item>
<processor>0</processor>
<vendor>GenuineIntel</vendor>
<model>Intel(R) Xeon(R) CPU E5504 @ 2.00GHz</model>
<frequency>1999.768</frequency>
<cache-size>4096</cache-size>
<bogomips>4008.600</bogomips>
</item>
<item>
<processor>1</processor>
<vendor>GenuineIntel</vendor>
<model>Intel(R) Xeon(R) CPU E5504 @ 2.00GHz</model>
<frequency>1999.768</frequency>
<cache-size>4096</cache-size>
<bogomips>4000.430</bogomips>
</item>
....
</result>
</ns1:getcpuinfoResponse>
</SOAP-ENV:Body></SOAP-ENV:Envelope>
Traceback (most recent call last):
File "/path/to/source/src/test.py", line 24, in <module>
result = client.service.getcpuinfo()
File "build/bdist.macosx-10.6-universal/egg/suds/client.py", line 542, in __call__
File "build/bdist.macosx-10.6-universal/egg/suds/client.py", line 602, in invoke
File "build/bdist.macosx-10.6-universal/egg/suds/client.py", line 643, in send
File "build/bdist.macosx-10.6-universal/egg/suds/client.py", line 678, in succeeded
File "build/bdist.macosx-10.6-universal/egg/suds/bindings/binding.py", line 165, in get_reply
File "build/bdist.macosx-10.6-universal/egg/suds/umx/typed.py", line 66, in process
File "build/bdist.macosx-10.6-universal/egg/suds/umx/core.py", line 48, in process
File "build/bdist.macosx-10.6-universal/egg/suds/umx/core.py", line 63, in append
File "build/bdist.macosx-10.6-universal/egg/suds/umx/core.py", line 140, in append_children
File "build/bdist.macosx-10.6-universal/egg/suds/umx/core.py", line 61, in append
File "build/bdist.macosx-10.6-universal/egg/suds/umx/encoded.py", line 47, in start
File "build/bdist.macosx-10.6-universal/egg/suds/umx/typed.py", line 77, in start
File "build/bdist.macosx-10.6-universal/egg/suds/resolver.py", line 337, in find
File "build/bdist.macosx-10.6-universal/egg/suds/resolver.py", line 384, in known
File "build/bdist.macosx-10.6-universal/egg/suds/xsd/query.py", line 46, in __init__
Exception: (cpuinfo, None, ), must be qref
here is part of my code :
from suds.client import Client
from suds.transport.http import HttpAuthenticated
import logging
logging.basicConfig(level=logging.INFO)
logging.getLogger('suds.client').setLevel(logging.DEBUG)
t = HttpAuthenticated(username='test', password='test')
wsdl = "file:///path/to/wsdl/file/src/videoserver2.wsdl"
server = "http://IP.OF.SER.VER:8080/VServer2.cgi"
client = Client(wsdl, transport=t)
client.set_options(location=server)
print client.service.getcpuinfo()
here is an extract of the wsdl file:
<complexType name="cpuinfo">
<sequence>
<element name="processor" type="xsd:int" minOccurs="1" maxOccurs="1"/>
<element name="vendor" type="xsd:string" minOccurs="0" maxOccurs="1" nillable="true"/>
<element name="model" type="xsd:string" minOccurs="0" maxOccurs="1" nillable="true"/>
<element name="frequency" type="xsd:double" minOccurs="1" maxOccurs="1"/>
<element name="cache-size" type="xsd:int" minOccurs="1" maxOccurs="1"/>
<element name="bogomips" type="xsd:double" minOccurs="1" maxOccurs="1"/>
</sequence>
</complexType>
<complexType name="ArrayOfcpuinfo">
<complexContent>
<restriction base="SOAP-ENC:Array">
<sequence>
<element name="item" type="ns1:cpuinfo" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute ref="SOAP-ENC:arrayType" WSDL:arrayType="ns1:cpuinfo[]"/>
</restriction>
</complexContent>
</complexType>
<message name="getcpuinfoRequest">
</message>
<message name="getcpuinfoResponse">
<part name="result" type="ns1:ArrayOfcpuinfo"/>
</message>
<operation name="getcpuinfo">
<documentation>Service definition of function ns1__getcpuinfo</documentation>
<input message="tns:getcpuinfoRequest"/>
<output message="tns:getcpuinfoResponse"/>
</operation>
any hint would be apreciated!
kind regards
Lorenz Martens
12 years, 7 months
How to handle 403 HTTP errors
by filtered
We connect with suds 0.4 to Sharepoint.
In case of a 403/Unauthorized response (because of improper credentials),
Sharepoint responds with
an *HTML* error message as body causing the following (unrelated) traceback:
File "example.py", line 16, in ?
service = connector.Connector(url, username, password, list_id)
File
"/local/HRS2/Devel/junga/haufe.sharepoint/haufe/sharepoint/connector.py",
line 36, in Connector
return ListEndpoint(client, list_id)
File
"/local/HRS2/Devel/junga/haufe.sharepoint/haufe/sharepoint/connector.py",
line 82, in __init__
self.model = self._getFields()
File
"/local/HRS2/Devel/junga/haufe.sharepoint/haufe/sharepoint/connector.py",
line 89, in _getFields
list_ = self.service.GetList(self.list_id)
File
"/local/HRS2/Devel/junga/haufe.sharepoint/lib/python2.4/site-packages/suds-0.4.1-py2.4.egg/suds/client.py",
line 542, in __call__
return client.invoke(args, kwargs)
File
"/local/HRS2/Devel/junga/haufe.sharepoint/lib/python2.4/site-packages/suds-0.4.1-py2.4.egg/suds/client.py",
line 602, in invoke
result = self.send(soapenv)
File
"/local/HRS2/Devel/junga/haufe.sharepoint/haufe/sharepoint/patches.py", line
61, in send
result = self.succeeded(binding, reply.message)
File
"/local/HRS2/Devel/junga/haufe.sharepoint/lib/python2.4/site-packages/suds-0.4.1-py2.4.egg/suds/client.py",
line 688, in succeeded
reply, result = binding.get_reply(self.method, reply)
File
"/local/HRS2/Devel/junga/haufe.sharepoint/lib/python2.4/site-packages/suds-0.4.1-py2.4.egg/suds/bindings/binding.py",
line 145, in get_reply
replyroot = sax.parse(string=reply)
File
"/local/HRS2/Devel/junga/haufe.sharepoint/lib/python2.4/site-packages/suds-0.4.1-py2.4.egg/suds/sax/parser.py",
line 136, in parse
sax.parse(source)
File
"/HRS2/local/lib/python2.4/site-packages/_xmlplus/sax/expatreader.py", line
109, in parse
xmlreader.IncrementalParser.parse(self, source)
File "/HRS2/local/lib/python2.4/site-packages/_xmlplus/sax/xmlreader.py",
line 123, in parse
self.feed(buffer)
File
"/HRS2/local/lib/python2.4/site-packages/_xmlplus/sax/expatreader.py", line
220, in feed
self._err_handler.fatalError(exc)
File "/HRS2/local/lib/python2.4/site-packages/_xmlplus/sax/handler.py",
line 38, in fatalError
raise exception
xml.sax._exceptions.SAXParseException: <unknown>:11:2: mismatched tag
Is there a better way to propagate the 403 response back to the application?
-aj
12 years, 7 months
Turn your professional experience into the Univresity Dergee you deserve. cancun business for sale
by Roberta Boykin
D E wzf G R ap E E___P qug R O nza G R mba A M
Obtain the deg nwr ree you des zi erve, based on your present kn gur owl gut ed bil ge and wo eg rk ex em per kjw ien ul ce.
A pro ehh spe vi rous future, mo yq ney earning power, and the Ad pwc mira eq tion of all.
Degre kp es from an Estab pdd lished, Prest kgq igious, Leadi pqw ng Insti tw tution.
Your Deg zmz ree will show exactly what you really can do.
Get the Jo vs b, Promot jg ion, Bu fs siness Op pcy portun vj ity
and So gp cial Advanc mzf ement you Desi sxl re!
Elimi oj nates classr sn ooms and traveling.
Ach she ieve your Bache kyx lors, Mas dph ters, M yv B nhf A, or P rw h tl D
in the field of your exper xj tise
Pr ks ofes sn sion uk al and af dsq fordable
Ca atp ll now - your Gr ib aduati rdf on is a ph usp one call away.
Please c mk al lsf l:___+ 1 fsn - 6 oe 46 - 53 la 7 - 1 zdg 73 zwe 2
12 years, 7 months
The education it�s prestigious !
by Josefina Corbin
You have a choice today!
We are an experienced company, who will give you a big chance!
How many days and hours should you spend at the university?
Yes…it is too long!
We offer you the way much better!
100% verified Degree: Bachelors, Masters and Doctorate (PHD).
Our professionals will answer to any your questions and suggest you the best choice!
Make it now! Make your life easier!
You should wait only 2-4 weeks.
We will help you!
+ 1 - 646 - 537 - 1732
Please leave us your:
1) Your Name
2) Your Country
3) Phone No. with countrycode if outside USA
Do Not Reply to this Email.
We do not reply to text inquiries, and our server will reject all response traffic.
We apologize for any inconvenience this may have caused you.
12 years, 7 months
The education it�s prestigious !
by Frank Baca
You have a choice today!
We are an experienced company, who will give you a big chance!
How many days and hours should you spend at the university?
Yes…it is too long!
We offer you the way much better!
100% verified Degree: Bachelors, Masters and Doctorate (PHD).
Our professionals will answer to any your questions and suggest you the best choice!
Make it now! Make your life easier!
You should wait only 2-4 weeks.
We will help you!
+ 1 - 646 - 537 - 1732
Please leave us your:
1) Your Name
2) Your Country
3) Phone No. with countrycode if outside USA
Do Not Reply to this Email.
We do not reply to text inquiries, and our server will reject all response traffic.
We apologize for any inconvenience this may have caused you.
12 years, 7 months
sending method (MessagePlugin)
by renato@cria.org.br
Hi,
I couldn't find a way to submit a new ticket, so I'm sending this to the
mailing list.
I needed to change the XML message in a SOAP call, so I followed the
documentation and tried to do that by using the "sending" method in a
plugin class derived from the MessagePlugin (documentation says that the
sending method "Provides the plugin with the opportunity to inspect/modify
the message text before it is sent").
However, I only got it working after changing line 634 in client.py by
replacing:
plugins.message.sending(envelope=soapenv)
with:
ctx = plugins.message.sending(envelope=soapenv)
soapenv = ctx.envelope
Regards,
--
Renato
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
12 years, 7 months