The following is the core code of the SOA interface call
# !/usr/bin/python # Coding:utf-8 from Import Client
def soarequest (wsdl,fnname,data): = Client (WSDL). Service = getattr (soaservice,fnname) (data) return Soarep
The problem arises:
I call an interface, always error, see:
After the debug breakpoint is positioned to the Suds module, the open method of the import class in the sxbasic.py file
defopen (Self, options):"""Open and import the refrenced schema. @param options:an Options Dictionary. @type options:l{options. Options} @return: the referenced schema. @rtype: L{schema}""" ifself.opened:returnself.opened=True Log.debug ('%s, importing ns= "%s", location= "%s "', Self.id, Self.ns[1], self.location) result=self.locate ()ifResult isNone:ifSelf.location isNone:log.debug ('imported schema (%s) Not-found', self.ns[1]) Else:result =self.download (Options) Log.debug ('imported:\n%s', result)returnResult
Log Print when self.location is None, or execute download
And the interface I'm testing has this problem, a relies on b,b in dependency c,c in a, cyclic dependency
Everything's going to be a problem.
All right, then change it.
To define an array variable outside of class import resultlist = []
defopen (Self, options):Globalresultlist# declaring global variables ifself.opened:returnself.opened=True Log.debug ('%s, importing ns= "%s", location= "%s "', Self.id, Self.ns[1], self.location) result=self.locate ()ifResult isNone:ifSelf.location isNone:log.debug ('imported schema (%s) Not-found', self.ns[1]) Else: ifSelf.locationinchResultList:log.debug ('already in Resultlist') #list中存在, which means that the download has completedElse:result =self.download (Options) resultlist.append (self.location) #下载完成后, add a record to the list Log.debug ('imported:\n%s', result)returnResult
That should be fine, run, or report the same mistake.
Continue debugging
。
Resultlist has been found to be empty, that is, the operation to add a record after the download operation is not executed
So I reversed the order.
Direct success
defopen (Self, options):Globalresultlist ifself.opened:returnself.opened=True Log.debug ('%s, importing ns= "%s", location= "%s "', Self.id, Self.ns[1], self.location) result=self.locate ()ifResult isNone:ifSelf.location isNone:log.debug ('imported schema (%s) Not-found', self.ns[1]) Else: ifSelf.locationinchResultList:log.debug ('already in Resultlist') Else: Resultlist.append (self.location) result=self.download (Options) Log.debug ('imported:\n%s', result)returnResult
Kee Suds Module Cycle-dependent pits