#9 ZSI.client.Binding

open
nobody
None
5
2004-03-14
2004-03-14
Tobias Grasl
No

Hi,

I am playing around with ZSI to access a webservice,
and am trying to parse a complex type into defined class.

I was using the Binding as suggested in "Client Side
Examples" in the ZSI docs, but I always got an error
complaining about the type.

For example, to call a service DOTest I executed:

import MyTypes
from ZSI.client import Binding
fp = open('debug.out','a')
b =
Binding(url='/url/TestService.asmx',soapaction='http://myservice/DOTest',ns='http://myservice/',tracefile=fp,
typesmodule=MyTypes)
do = b.DOTest()

However, b.DOTest would never pick up the complex type
I had defined because in __Caller__ this is called:

def __call__(self, *args):
return self.binding.RPC(None, self.name, args,
TC.Any(),
requesttypecode=TC.Any(self.name,
aslist=1))

By passing the TC.Any(), it is disabling the mechanism
that looks up complex type definitions.

I modified the code to look like this:

def __call__(self, *args):
return self.binding.RPC(None, self.name, args,
None,
requesttypecode=TC.Any(self.name,
aslist=1))

Now it works !

Not sure this is desirable in general, but certainly
with the current method the example does not work as
presented in the docs.

Thanks,

tobyg

Discussion