A fork of https://github.com/Synerty/SOAPpy-py3 This is a working tree till fixes get imported upstream.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

51 lines
1.1 KiB

  1. from SOAPpy import SOAP
  2. import sys
  3. import getopt
  4. def usage():
  5. print """usage: %s [options]
  6. -m, --method=METHOD#[,METHOD#...] specify METHOD# of ? for the list
  7. -p, --port=PORT# allows to specify PORT# of server
  8. """
  9. sys.exit(1)
  10. def methodUsage():
  11. print "The available methods are:"
  12. print "1. Monitor \t\t2. Clear"
  13. sys.exit(0)
  14. port = 12080
  15. methodnum = 1
  16. try:
  17. opts, args = getopt.getopt (sys.argv[1:], 'p:m:', ['method','port'])
  18. for opt, arg in opts:
  19. if opt in ('-m','--method'):
  20. if arg == '?':
  21. methodUsage()
  22. methodnum = int(arg)
  23. elif opt in ('-p', '--port'):
  24. port = int(arg)
  25. else:
  26. raise AttributeError, "Recognized but unimpl option '%s'" % opt
  27. except SystemExit:
  28. raise
  29. except:
  30. usage ()
  31. ep = "http://208.177.157.221:%d/xmethodsInterop" % (port)
  32. sa = "urn:soapinterop"
  33. ns = "http://www.soapinterop.org/Bid"
  34. serv = SOAP.SOAPProxy(ep, namespace =ns, soapaction = sa)
  35. if methodnum == 1:
  36. print serv.Monitor(str="actzero")
  37. elif methodnum == 2:
  38. print serv.Clear(str="actzero")
  39. else:
  40. print "invalid methodnum"
  41. methodUsage()