0.3.8 and arrays
by Robert Marsanyi
Hi, Jeff. Thanks for the array handling upgrade, and incorporating the
example of an ArrayOfInteger into the mssoapinterop example in public.py.
Works great.
So I'm trying to extend it to handle my particular case, and not having any
success. In this case, I have an ArrayOfOrderData embedded in a structure,
where OrderData is a 3-element structure of string, string, base64binary
(I'm not using this last one). For details, the WSDL is at
http://www.customcd.us:8009/test/TestOrderReceiver.wsdl
I'm not able to set up an ArrayOfOrderData in the OrderInfo parent
structure, and put two OrderData elements in it. I've tried creating an
ArrayOfOrderData with an items[] attribute; creating an Array and setting
the _arrayType to OrderData[], and using an items[] attribute.
Sorry to be so dense, but what am I missing?
--rbt
13 years, 10 months
UTF-8 encoding issue in 0.3.8?
by David Lanstein
Hi Jeff,
My unit tests are now failing in the 0.3.8 beta, all with the same error: UnicodeEncodeError: 'ascii' codec can't encode character u'\xeb' in position 2: ordinal not in range(128). I'll pull together a test case, but in the meantime, an example raw SOAP request is (note the umlauts and Chinese chars):
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:ns0="urn:partner.soap.sforce.com" xmlns:ns1="urn:sobject.partner.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="urn:partner.soap.sforce.com" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header>
<tns:SessionHeader>
<tns:sessionId>xxx</tns:sessionId>
</tns:SessionHeader>
<tns:CallOptions>
<tns:client>xxx</tns:client>
<tns:defaultNamespace>xxx</tns:defaultNamespace>
</tns:CallOptions>
<tns:AssignmentRuleHeader>
<tns:assignmentRuleId xsi:nil="true"/>
<tns:useDefaultRule>true</tns:useDefaultRule>
</tns:AssignmentRuleHeader>
<tns:MruHeader>
<tns:updateMru>true</tns:updateMru>
</tns:MruHeader>
<tns:AllowFieldTruncationHeader>
<tns:allowFieldTruncation>false</tns:allowFieldTruncation>
</tns:AllowFieldTruncationHeader>
<tns:PackageVersionHeader>
<tns:packageVersions>{majorNumber = 3, namespace = SFGA, minorNumber = 0, }</tns:packageVersions>
</tns:PackageVersionHeader>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<ns0:create>
<ns0:sObjects>
<ns1:type>Lead</ns1:type>
<ns1:Id xsi:nil="true"/>
<ns1:FirstName>Joë</ns1:FirstName>
<ns1:LastName>Möke</ns1:LastName>
<ns1:Company>你好公司</ns1:Company>
<ns1:Email>joe(a)example.com</ns1:Email>
</ns0:sObjects>
<ns0:sObjects>
<ns1:type>Lead</ns1:type>
<ns1:Id xsi:nil="true"/>
<ns1:FirstName>Böb</ns1:FirstName>
<ns1:LastName>Möke</ns1:LastName>
<ns1:Company>你好公司</ns1:Company>
<ns1:Email>bob(a)example.com</ns1:Email>
</ns0:sObjects>
</ns0:create>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
13 years, 10 months
Cannot import a web service
by Antoine Sirinelli
Hello,
I am trying to use Suds with the English Live Departure Board Web Service. This
service is documented there: http://www.livedepartureboards.co.uk/ldbws/
If I try to connect a suds client to this service:
c=suds.client.Client('http://realtime.nationalrail.co.uk/ldbws/wsdl.aspx')
I get an AttributeError: "'list' object has no attribute 'root'" at the line
"types.root.append(d.root)" in wsdl.py (line 365)
I have the same error for the version 0.3.7, 0.3.8 and the SVN.
If someone has an idea how I could use this webserservice, I would appreciate
any help.
Many thanks,
Antoine
13 years, 10 months
soap encoded arrays in 0.3.8
by Jeff Ortel
All,
Hopefully, this is good news :)
Revision 607 completes unmarshaller side of the 'enhanced soap (section 5) encoded arrays'
feature in 0.3.8. What this does is flatten the soap encoded arrays in rpc/encoded
services into python lists. Remember, soap encoded arrays are Array objects which contain
a collection of <xs:any/>. So, for an array of (int), the XML would look like this:
<foo>
<numbers xsi:type="soap-enc:Array" soap-enc:arrayType="xs:int[2]">
<number>1</number>
<number>2</number>
</numbers>
</foo>
In suds <= 0.3.7, this would be unmarshalled literally as:
foo {
numbers {
number = ["1","2"]
}
}
Or if the <number xsi:type="xs:int"/> had the xsi:type attribute,
foo {
numbers {
number = [1,2]
}
}
because suds was interpreting the schema literally, that is what you got.
In 0.3.8, the Encoded unmarshaller interprets and flattens the encoded array
and gives you what you would expect:
foo {
numbers = [1,2]
}
A nice python list of integers :) which is symmetrical to what you would pass as an
argument or nested attribute value. And, this is how rpc/literal and document/literal
services have returned arrays for a long time.
Also, in <= 0.3.7, empty soap encoded arrays were *not* represented as:
foo {
numbers {
number = []
}
}
But rather:
foo {
numbers {
number = ''
}
}
which is broken.
In 0.3.8, this was also fixed. Empty arrays are represented consistently as [].
BIG WARNING HERE:
Please notice that this feature changes the form of returned soap encoded arrays and WILL
break some of your code. For this, I am really sorry and hope that you will agree that
the benefits outweigh the hassle of porting you code after upgrade.
Regards,
Jeff
13 years, 10 months
Suds and no internet connection
by Elyrwen Dynesh
Hello,
I need to use suds to parse a wsdl available on my local network, however
there is no connection
to the internet. Port 80 is blocked in and out. What are my options? So far,
I was thinking about the following solutions:
1. Unblock 80 and let suds parse the wsdl and create the schemas in
/tmp/suds. Then block 80 and use suds normally. This seems to work, however
I don't know how long? Is there any caching
13 years, 10 months
Arrays, again
by Robert Marsanyi
I see lots of history about using array complex types in SOAP requests, but
I still can't divine how to do it right. Ultimately, I need to generate an
array of complex structures, but the array part is baffling me, so I thought
I'd start with an array of integers, using a service that's specifically
designed for testing.
Using the WSDL specified in public.py at
http://mssoapinterop.org/asmx/simple.asmx?WSDL, I'm trying to use the
echoIntegerArray service. I've tried a number of different ways to build
the array in the request call, but none seem to work; every request returns
a syntactically correct, but empty, response (that is,
result=client.service.echoIntegerArray(array)) always returns None,
regardless of the machinations I use to construct the variable "array".
Can someone show me the client code for an array of ints that works with
this service?
--rbt
13 years, 10 months
Soap not Found Error:
by Christian Klinger
Hi Matt,
sorry i send this to matt instead of the mailinglist...
now i have changed my code to this:
def ga():
client = Client('http://ws_mub_prod:8080/BETRWS.wsdl')
print client
BETRIEB_EING = client.factory.create('ETBSRV2-BETRWS-BETRIEB_EING')
BETRIEB_EING.P_KNR_E = "0101010001"
result = client.service.BETRWS(BETRIEB_EING=BETRIEB_EING)
print result
But i got the same error....
No handlers could be found for logger "suds.umx.typed"
Traceback (most recent call last):
File "sd.py", line 11, in ?
print ga()
File "sd.py", line 8, in ga
result = client.service.BETRWS(BETRIEB_EING=BETRIEB_EING)
File "/tmp/sudstest/suds/suds/client.py", line 535, in __call__
return client.invoke(args, kwargs)
File "/tmp/sudstest/suds/suds/client.py", line 595, in invoke
result = self.send(msg)
File "/tmp/sudstest/suds/suds/client.py", line 624, in send
result = self.succeeded(binding, reply.message)
File "/tmp/sudstest/suds/suds/client.py", line 656, in succeeded
r, p = binding.get_reply(self.method, reply)
File "/tmp/sudstest/suds/suds/bindings/binding.py", line 149, in
get_reply
result = self.replycomposite(rtypes, nodes)
File "/tmp/sudstest/suds/suds/bindings/binding.py", line 206, in
replycomposite
sobject = unmarshaller.process(node, resolved)
File "/tmp/sudstest/suds/suds/umx/typed.py", line 57, in process
return Core.process(self, content)
File "/tmp/sudstest/suds/suds/umx/core.py", line 48, in process
data, result = self.append(content)
File "/tmp/sudstest/suds/suds/umx/core.py", line 64, in append
self.append_children(content)
File "/tmp/sudstest/suds/suds/umx/core.py", line 141, in append_children
cdata, cval = self.append(cont)
File "/tmp/sudstest/suds/suds/umx/core.py", line 64, in append
self.append_children(content)
File "/tmp/sudstest/suds/suds/umx/core.py", line 141, in append_children
cdata, cval = self.append(cont)
File "/tmp/sudstest/suds/suds/umx/core.py", line 62, in append
self.start(content)
File "/tmp/sudstest/suds/suds/umx/typed.py", line 71, in start
raise TypeNotFound(content.node.qname())
suds.TypeNotFound: Type not found: 'BETRIEB'
i don't find a solution so i stepped in the pdb to look whats going on:
Maybe someone can look on this pdb-session. It seems that suds can not find
the node "Betrieb" on the parent
-> def find(self, node, resolved=False, push=True):
(Pdb) l
313 @param schema: A schema object.
314 @type schema: L{xsd.schema.Schema}
315 """
316 TreeResolver.__init__(self, schema)
317
318 -> def find(self, node, resolved=False, push=True):
319 """
320 @param node: An xml node to be resolved.
321 @type node: L{sax.element.Element}
322 @param resolved: A flag indicating that the fully
resolved type should be
323 returned.
(Pdb) n
> /tmp/sudstest/suds/suds/resolver.py(331)find()
-> name = node.name
(Pdb) n
> /tmp/sudstest/suds/suds/resolver.py(332)find()
-> parent = self.top().resolved
(Pdb) n
> /tmp/sudstest/suds/suds/resolver.py(333)find()
-> if parent is None:
(Pdb) n
> /tmp/sudstest/suds/suds/resolver.py(336)find()
-> result, ancestry = self.getchild(name, parent)
(Pdb) n
> /tmp/sudstest/suds/suds/resolver.py(337)find()
-> known = self.known(node)
(Pdb) result
(Pdb) name
u'BETRIEB'
(Pdb) print str(parent)
<Element:0x2acce46c9b48 name="BETRIEB">
<Complex:0x2acce46c9cf8>
<Sequence:0x2acce46c9e18>
<Element:0x2acce46c9f80 name="P_KNR" type="(u'string',
http://www.w3.org/2001/XMLSchema)" />
<Element:0x2acce46ca170 name="P_NAME-1" type="(u'string',
http://www.w3.org/2001/XMLSchema)" />
<Element:0x2acce46ca248 name="P_NAME-2" type="(u'string',
http://www.w3.org/2001/XMLSchema)" />
<Element:0x2acce46ca320 name="P_NAME-3" type="(u'string',
http://www.w3.org/2001/XMLSchema)" />
<Element:0x2acce46ca3f8 name="P_STRASSE" type="(u'string',
http://www.w3.org/2001/XMLSchema)" />
<Element:0x2acce46ca4d0 name="P_HAUSNR" type="(u'string',
http://www.w3.org/2001/XMLSchema)" />
<Element:0x2acce46ca5a8 name="P_PLZ" type="(u'string',
http://www.w3.org/2001/XMLSchema)" />
<Element:0x2acce46ca680 name="P_ORT" type="(u'string',
http://www.w3.org/2001/XMLSchema)" />
<Element:0x2acce46ca758 name="P_BV" type="(u'string',
http://www.w3.org/2001/XMLSchema)" />
<Element:0x2acce46ca830 name="P_GEL" type="(u'string',
http://www.w3.org/2001/XMLSchema)" />
<Element:0x2acce46ca908 name="P_SACHB" type="(u'string',
http://www.w3.org/2001/XMLSchema)" />
<Element:0x2acce46ca9e0 name="P_TEL" type="(u'string',
http://www.w3.org/2001/XMLSchema)" />
</Sequence>
</Complex>
</Element>
Any ideas?
Christian
13 years, 10 months
Connection time out
by Jerzy Orlowski
Hi
My service takes ~5 minutes time. When I call it, I get:
Traceback (most recent call last):
File "test_soap_global2.py", line 2151, in <module>
result=client.service.soap_create_model(INPUT_PDB, INPUT_ALIGNMENT,
TEMP_CHAIN_NAME, MODEL_CHAIN_NAME)
File "build/bdist.linux-x86_64/egg/suds/client.py", line 537, in __call__
File "build/bdist.linux-x86_64/egg/suds/client.py", line 597, in invoke
File "build/bdist.linux-x86_64/egg/suds/client.py", line 622, in send
File "build/bdist.linux-x86_64/egg/suds/transport/http.py", line 85,
in send
File "build/bdist.linux-x86_64/egg/suds/transport/http.py", line 107,
in __open
File "/usr/lib/python2.6/urllib2.py", line 389, in open
response = self._open(req, data)
File "/usr/lib/python2.6/urllib2.py", line 407, in _open
'_open', req)
File "/usr/lib/python2.6/urllib2.py", line 367, in _call_chain
result = func(*args)
File "/usr/lib/python2.6/urllib2.py", line 1146, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "/usr/lib/python2.6/urllib2.py", line 1121, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error timed out>
Jerzy Orlowski
13 years, 10 months
Error with Suds: error: suds.TypeNotFound: Type not found: 'BETRIEB'
by Christian Klinger
Hi
i try to access a soap service with this script:
from suds.client import Client
def ga():
client = Client('http://ws_mub_prod:8080/BETRWS.wsdl')
print client
BETRIEB_EING = client.factory.create('ETBSRV2-BETRWS-BETRIEB_EING')
BETRIEB_EING = "0101010001"
result = client.service.BETRWS(BETRIEB_EING)
print result
The result/traceback of this script is this:
svcdrupanet01:/tmp/sudstest # bin/python sd.py
Suds ( https://fedorahosted.org/suds/ ) version: 0.3.7 GA build:
R580-20091016
Service ( BETRWS ) tns="http://namespaces.softwareag.com/entirex/xml/me"
Prefixes (1)
ns0 = "http://namespaces.softwareag.com/entirex/xml/me"
Ports (1):
(ETBSRV2Port)
Methods (1):
BETRWS(ETBSRV2-BETRWS-BETRIEB_EING BETRIEB_EING, )
Types (2):
ETBSRV2-BETRWS-Array
ETBSRV2-BETRWS-BETRIEB_EING
No handlers could be found for logger "suds.umx.typed"
Traceback (most recent call last):
File "sd.py", line 11, in ?
print ga()
File "sd.py", line 8, in ga
result = client.service.BETRWS(BETRIEB_EING)
File "/tmp/sudstest/suds/suds/client.py", line 535, in __call__
return client.invoke(args, kwargs)
File "/tmp/sudstest/suds/suds/client.py", line 595, in invoke
result = self.send(msg)
File "/tmp/sudstest/suds/suds/client.py", line 624, in send
result = self.succeeded(binding, reply.message)
File "/tmp/sudstest/suds/suds/client.py", line 656, in succeeded
r, p = binding.get_reply(self.method, reply)
File "/tmp/sudstest/suds/suds/bindings/binding.py", line 149, in
get_reply
result = self.replycomposite(rtypes, nodes)
File "/tmp/sudstest/suds/suds/bindings/binding.py", line 206, in
replycomposite
sobject = unmarshaller.process(node, resolved)
File "/tmp/sudstest/suds/suds/umx/typed.py", line 57, in process
return Core.process(self, content)
File "/tmp/sudstest/suds/suds/umx/core.py", line 48, in process
data, result = self.append(content)
File "/tmp/sudstest/suds/suds/umx/core.py", line 64, in append
self.append_children(content)
File "/tmp/sudstest/suds/suds/umx/core.py", line 141, in append_children
cdata, cval = self.append(cont)
File "/tmp/sudstest/suds/suds/umx/core.py", line 64, in append
self.append_children(content)
File "/tmp/sudstest/suds/suds/umx/core.py", line 141, in append_children
cdata, cval = self.append(cont)
File "/tmp/sudstest/suds/suds/umx/core.py", line 62, in append
self.start(content)
File "/tmp/sudstest/suds/suds/umx/typed.py", line 71, in start
raise TypeNotFound(content.node.qname())
suds.TypeNotFound: Type not found: 'BETRIEB'
And here is the wsdl file:
<?xml version='1.0' ?>
<!-- Generated 13.09.2004 14:02:50 by Software AG SOAP Toolkit Wizard,
Version 1.1 -->
<definitions name='ETBSRV2'
targetNamespace='http://namespaces.softwareag.com/entirex/xml/me'
xmlns='http://schemas.xmlsoap.org/wsdl/'
xmlns:xsd='http://www.w3.org/2001/XMLSchema'
xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'
xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/'
xmlns:tns='http://namespaces.softwareag.com/entirex/xml/me'
>
<types>
<schema
targetNamespace='http://namespaces.softwareag.com/entirex/xml/me'
xmlns='http://www.w3.org/2001/XMLSchema'>
<xsd:complexType name='ETBSRV2-BETRWS-BETRIEB_EING'>
<xsd:sequence>
<xsd:element name='P_KNR_E' type='xsd:string'/>
<xsd:element name='P_ISN_E' type='xsd:decimal'/>
<xsd:element name='P_NAME-1_E' type='xsd:string'/>
<xsd:element name='P_NAME-2_E' type='xsd:string'/>
<xsd:element name='P_NAME-3_E' type='xsd:string'/>
<xsd:element name='P_STRASSE_E' type='xsd:string'/>
<xsd:element name='P_HAUSNR_E' type='xsd:string'/>
<xsd:element name='P_PLZ_E' type='xsd:string'/>
<xsd:element name='P_ORT_E' type='xsd:string'/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name='ETBSRV2-BETRWS-Array'>
<xsd:sequence>
<xsd:element name='BETRIEB' minOccurs='1' maxOccurs='50'>
<xsd:complexType>
<xsd:sequence>
<xsd:element name='P_KNR' type='xsd:string'/>
<xsd:element name='P_NAME-1' type='xsd:string'/>
<xsd:element name='P_NAME-2' type='xsd:string'/>
<xsd:element name='P_NAME-3' type='xsd:string'/>
<xsd:element name='P_STRASSE' type='xsd:string'/>
<xsd:element name='P_HAUSNR' type='xsd:string'/>
<xsd:element name='P_PLZ' type='xsd:string'/>
<xsd:element name='P_ORT' type='xsd:string'/>
<xsd:element name='P_BV' type='xsd:string'/>
<xsd:element name='P_GEL' type='xsd:string'/>
<xsd:element name='P_SACHB' type='xsd:string'/>
<xsd:element name='P_TEL' type='xsd:string'/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</schema>
</types>
<message name='BETRWS'>
<part name='BETRIEB_EING' type='tns:ETBSRV2-BETRWS-BETRIEB_EING'/>
</message>
<message name='BETRWSResponse'>
<part name='Array' type='tns:ETBSRV2-BETRWS-Array'/>
<part name='P_ISN_E' type='xsd:decimal'/>
</message>
<portType name='ETBSRV2Port'>
<operation name='BETRWS'>
<input message='tns:BETRWS'/>
<output message='tns:BETRWSResponse'/>
</operation>
</portType>
<binding name='ETBSRV2SoapBinding' type='tns:ETBSRV2Port'>
<soap:binding style='rpc' transport='http://schemas.xmlsoap.org/soap/http'/>
<operation name='BETRWS'>
<soap:operation soapAction='BETRWS'/>
<input>
<soap:body use='encoded'
encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'
namespace='urn:com-softwareag-entirex-rpc:ETBSRV2'
/>
</input>
<output>
<soap:body use='encoded'
encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'
namespace='urn:com-softwareag-entirex-rpc:ETBSRV2'
/>
</output>
</operation>
</binding>
<service name='BETRWS'>
<port name='ETBSRV2Port' binding='tns:ETBSRV2SoapBinding'>
<soap:address location='http://ws_mub_prod:8080/WS_7.2.1p50'/>
</port>
</service>
</definitions>
Thanks for your help....
If you need more information please ask.
Christian
13 years, 10 months