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.
 
 
 
 

103 lines
2.5 KiB

  1. #!/usr/bin/env python
  2. # Copyright (c) 2001 actzero, inc. All rights reserved.
  3. import sys
  4. sys.path.insert(1, "..")
  5. from SOAPpy import *
  6. # Uncomment to see outgoing HTTP headers and SOAP and incoming
  7. #Config.debug = 1
  8. #Config.dumpHeadersIn = 1
  9. #Config.dumpSOAPIn = 1
  10. #Config.dumpSOAPOut = 1
  11. # ask for returned SOAP responses to be converted to basic python types
  12. Config.simplify_objects = 1
  13. #Config.BuildWithNoType = 1
  14. #Config.BuildWithNoNamespacePrefix = 1
  15. if len(sys.argv) > 1 and sys.argv[1] == '-s':
  16. # Use secure http
  17. pathserver = SOAPProxy("https://localhost:9900/pathtest")
  18. server = SOAPProxy("https://localhost:9900")
  19. elif len(sys.argv) > 1 and sys.argv[1] == '-g':
  20. # use Globus for communication
  21. import pyGlobus
  22. pathserver = SOAPProxy("httpg://localhost:9900/pathtest")
  23. server = SOAPProxy("httpg://localhost:9900")
  24. else:
  25. # Default: use standard http
  26. pathserver = SOAPProxy("http://localhost:9900/pathtest")
  27. server = SOAPProxy("http://localhost:9900")
  28. # Echo...
  29. try:
  30. print(server.echo("MOO"))
  31. except Exception as e:
  32. print("Caught exception: ", e)
  33. try:
  34. print(pathserver.echo("MOO"))
  35. except Exception as e:
  36. print("Caught exception: ", e)
  37. # ...in an object
  38. try:
  39. print(server.echo_ino("moo"))
  40. except Exception as e:
  41. print("Caught exception: ", e)
  42. try:
  43. print(pathserver.echo_ino("cow"))
  44. except Exception as e:
  45. print("Caught exception: ", e)
  46. # ...in an object in an object
  47. try:
  48. print(server.prop.echo2("moo"))
  49. except Exception as e:
  50. print("Caught exception: ", e)
  51. try:
  52. print(pathserver.prop.echo2("cow"))
  53. except Exception as e:
  54. print("Caught exception: ", e)
  55. # ...with keyword arguments
  56. try:
  57. print(server.echo_wkw(third = "three", first = "one", second = "two"))
  58. except Exception as e:
  59. print("Caught exception: ", e)
  60. try:
  61. print(pathserver.echo_wkw(third = "three", first = "one", second = "two"))
  62. except Exception as e:
  63. print("Caught exception: ", e)
  64. # ...with a context object
  65. try:
  66. print(server.echo_wc("moo"))
  67. except Exception as e:
  68. print("Caught exception: ", e)
  69. try:
  70. print(pathserver.echo_wc("cow"))
  71. except Exception as e:
  72. print("Caught exception: ", e)
  73. # ...with a header
  74. hd = headerType(data = {"mystring": "Hello World"})
  75. try:
  76. print(server._hd(hd).echo_wc("moo"))
  77. except Exception as e:
  78. print("Caught exception: ", e)
  79. try:
  80. print(pathserver._hd(hd).echo_wc("cow"))
  81. except Exception as e:
  82. print("Caught exception: ", e)
  83. # close down server
  84. server.quit()