Difference between revisions of "ZSI Examples"
Jump to navigation
Jump to search
PeterHarding (talk | contribs) |
PeterHarding (talk | contribs) |
||
Line 108: | Line 108: | ||
</pre> | </pre> | ||
=Building Complex Type Arrays= | |||
<pre> | |||
So grab an interpreter and import the generated module, then use | |||
help() to look at the request you're trying to use. You'll probably | |||
see some helper methods and properties in there, | |||
new_ | |||
set_ | |||
get_ | |||
If that doesn't help provide the WSDL | |||
-josh | |||
On Feb 6, 2008, at 7:51 AM, Joseph Boiteau wrote: | |||
> Hi, | |||
> | |||
> I'm using a ZSI client interface generated with --complexType | |||
> option (ZSI 2.0) | |||
> When I try to construct a request properly, I cannot find a nice way | |||
> to instantiate the array object. | |||
> | |||
> A simple list [] seems to correspond to the array, but then I have | |||
> no parent object to instantiate an array element.. | |||
> | |||
> Using the second generated file (*_services_types.py), the element i | |||
> get using ns0.myDef_Def(None) is a basic object.. without specific | |||
> attributes or methods I need. | |||
> | |||
> So I'm looking after the manner to instantiate properly any sub-node | |||
> object. | |||
> | |||
> Thanks | |||
</pre> | |||
[[Category:Python]] | [[Category:Python]] | ||
[[Category:ZSI]] | [[Category:ZSI]] |
Revision as of 16:12, 19 February 2008
Some Python ZSI Examples
CDPBilling
SaintBook
$ cat wsdl.sh #!/bin/sh wget http://saintbook.org/MightyMaxims/MightyMaxims.asmx?WSDL
from ZSI.wstools import WSDLTools ... location = 'http://saintbook.org/MightyMaxims/MightyMaxims.asmx?WSDL' load = reader.loadFromURL wsdl = load(location) ...
Not sure works for me -josh $ mkdir TMP $ cd TMP/ $ wsdl2py http://saintbook.org/MightyMaxims/MightyMaxims.asmx?WSDL $ ls Maxim_client.py Maxim_server.py Maxim_types.py $ python Python 2.5.1 (r251:54863, May 23 2007, 10:06:54) [GCC 4.0.0 20041026 (Apple Computer, Inc. build 4061)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from ZSI.wstools import WSDLTools >>> location = 'http://saintbook.org/MightyMaxims/MightyMaxims.asmx?WSDL' >>> w = reader.loadFromURL(location) Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'reader' is not defined >>> reader = WSDLTools.WSDLReader() >>> w = reader.loadFromURL(location) >>> w <ZSI.wstools.WSDLTools.WSDL instance at 0xca080> On Jan 31, 2008, at 7:49 AM, Lorena Carlo wrote: > Hi, > > I don't know if this is a ZSI bug, but for some reason I can not load > the following webservice: > > http://saintbook.org/MightyMaxims/MightyMaxims.asmx?WSDL > > This is the portion of code: > > from ZSI.wstools import WSDLTools > location = 'http://saintbook.org/MightyMaxims/MightyMaxims.asmx?WSDL' > load = reader.loadFromURL > wsdl = load(location) > > This is the exception I get: > > Traceback (most recent call last): > File "<stdin>", line 1, in ? > File > "c:\Python24\lib\site-packages\zsi-2.1_a1-py2.4.egg\ZSI\wstools > \WSDLTools > .py", line 39, in loadFromURL > File > "c:\Python24\lib\site-packages\zsi-2.1_a1-py2.4.egg\ZSI\wstools > \Utility.p > y", line 642, in loadFromURL > File > "c:\Python24\lib\site-packages\zsi-2.1_a1-py2.4.egg\ZSI\wstools > \Utility.p > y", line 203, in urlopen > File > "c:\Python24\lib\site-packages\zsi-2.1_a1-py2.4.egg\ZSI\wstools > \Utility.p > y", line 153, in urlopen > File "c:\Python24\lib\urllib.py", line 82, in urlopen > return opener.open(url) > File "c:\Python24\lib\urllib.py", line 190, in open > return getattr(self, name)(url) > File "c:\Python24\lib\urllib.py", line 426, in open_file > return self.open_local_file(url) > File "c:\Python24\lib\urllib.py", line 440, in open_local_file > raise IOError(e.errno, e.strerror, e.filename) > IOError: [Errno 2] No such file or directory: > '\\MightyMaxims\\MightyMaxims.asmx > ?WSDL?65784000' > > Any help will be appreciated, thanks! > > Lorena
Building Complex Type Arrays
So grab an interpreter and import the generated module, then use help() to look at the request you're trying to use. You'll probably see some helper methods and properties in there, new_ set_ get_ If that doesn't help provide the WSDL -josh On Feb 6, 2008, at 7:51 AM, Joseph Boiteau wrote: > Hi, > > I'm using a ZSI client interface generated with --complexType > option (ZSI 2.0) > When I try to construct a request properly, I cannot find a nice way > to instantiate the array object. > > A simple list [] seems to correspond to the array, but then I have > no parent object to instantiate an array element.. > > Using the second generated file (*_services_types.py), the element i > get using ns0.myDef_Def(None) is a basic object.. without specific > attributes or methods I need. > > So I'm looking after the manner to instantiate properly any sub-node > object. > > Thanks