SOAPpy - Getting info about the __init__ method

Steve stever at cruzio.com
Wed Dec 6 18:14:51 EST 2006


Hi All,

I have a Python script that uses SOAPpy and I'm outputting all of the
methods and info about the parameters... I'm having trouble getting
information out of the __init__ parameter.


My code :

from SOAPpy import WSDL


def GetWebServicesMethods(url):
# requires import :
#from SOAPpy import WSDL

# just use the path to the wsdl of your choice

  full_url = url + '?WSDL'

  try:

    wsdlObject = WSDL.Proxy(full_url)

  except Exception:
    print "\n\nError in Getting WebServices Methods for : %s\n\n" %
full_url
    print "\tUnexpected error : %s \n \t\t\t  %s " %
(sys.exc_info()[0], sys.exc_info()[1])
    print
    return

  print '\nAvailable Methods for : %s\n\n' % (url)

#  print 'wsdlObject Raw : ', wsdlObject

#  print inspect.getmembers(wsdlObject)

  MethodCount = 1

  for method in wsdlObject.methods.keys() :
    print '\t %d)  %s\n' % (MethodCount, method)

    ci = wsdlObject.methods[method]   # get the details of the current
method

    for param in ci.outparams :
      # list of the function and type depending of the wsdl...

      AllParams = inspect.getmembers (param)

      for SubParam in AllParams:
        ParamName,ParamValue = SubParam
#        print '%15s = %s' % SubParam
        if ParamName == '__init__':
          print 'init_info = ', ParamValue
        else:
          print '%15s = %s' % (ParamName,ParamValue)

      input_parameter_values = ''

      for p in ci.getInParameters ():   # save the parameters to a
string
        input_parameter_values =  '%s\t\t Name : %s\n' %
(input_parameter_values, p.name)
        input_parameter_values =  '%s\t\t Type : %s\n\n' %
(input_parameter_values, p.type[1])

      if input_parameter_values:        # print only when there are
parameters
        print  '\n\n\t\tInput Parameters : \n'
        print input_parameter_values

    print
    print
    MethodCount = MethodCount + 1


Output :


         1)  getDate

        __doc__ = A ParameterInfo object captures parameter binding
information.

init_info =  <bound method ParameterInfo.__init__ of
<SOAPpy.wstools.WSDLTools.ParameterInfo instance at 0x00D4E198>>

*** How do I get the info out of the __init__  structure ???

     __module__ = SOAPpy.wstools.WSDLTools
        default = None
   element_type = 0
           name = getLastPromoOrSlottingDateReturn
      namespace = None
           type = (u'http://www.site.com/offerperf',
u'ArrayOfPerfPromoInfo')


                Input Parameters :

                 Name : in0
                 Type : ArrayOf_xsd_int


Thanks!

Steve




More information about the Python-list mailing list