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.
 
 
 
 

144 lines
5.1 KiB

  1. """
  2. GSIServer - Contributed by Ivan R. Judson <judson@mcs.anl.gov>
  3. ################################################################################
  4. #
  5. # SOAPpy - Cayce Ullman (cayce@actzero.com)
  6. # Brian Matthews (blm@actzero.com)
  7. # Gregory Warnes (Gregory.R.Warnes@Pfizer.com)
  8. # Christopher Blunck (blunck@gst.com)
  9. #
  10. ################################################################################
  11. # Copyright (c) 2003, Pfizer
  12. # Copyright (c) 2001, Cayce Ullman.
  13. # Copyright (c) 2001, Brian Matthews.
  14. #
  15. # All rights reserved.
  16. #
  17. # Redistribution and use in source and binary forms, with or without
  18. # modification, are permitted provided that the following conditions are met:
  19. # Redistributions of source code must retain the above copyright notice, this
  20. # list of conditions and the following disclaimer.
  21. #
  22. # Redistributions in binary form must reproduce the above copyright notice,
  23. # this list of conditions and the following disclaimer in the documentation
  24. # and/or other materials provided with the distribution.
  25. #
  26. # Neither the name of actzero, inc. nor the names of its contributors may
  27. # be used to endorse or promote products derived from this software without
  28. # specific prior written permission.
  29. #
  30. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  31. # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  32. # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  33. # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
  34. # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  35. # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  36. # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  37. # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  38. # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  39. # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  40. #
  41. ################################################################################
  42. """
  43. ident = '$Id: GSIServer.py,v 1.5 2005/02/15 16:32:22 warnes Exp $'
  44. from version import __version__
  45. from __future__ import nested_scopes
  46. #import xml.sax
  47. import re
  48. import socket
  49. import sys
  50. import SocketServer
  51. from types import *
  52. import BaseHTTPServer
  53. # SOAPpy modules
  54. from Parser import parseSOAPRPC
  55. from Config import SOAPConfig
  56. from Types import faultType, voidType, simplify
  57. from NS import NS
  58. from SOAPBuilder import buildSOAP
  59. from Utilities import debugHeader, debugFooter
  60. try: from M2Crypto import SSL
  61. except: pass
  62. #####
  63. from Server import *
  64. from pyGlobus.io import GSITCPSocketServer, ThreadingGSITCPSocketServer
  65. from pyGlobus import ioc
  66. def GSIConfig():
  67. config = SOAPConfig()
  68. config.channel_mode = ioc.GLOBUS_IO_SECURE_CHANNEL_MODE_GSI_WRAP
  69. config.delegation_mode = ioc.GLOBUS_IO_SECURE_DELEGATION_MODE_FULL_PROXY
  70. config.tcpAttr = None
  71. config.authMethod = "_authorize"
  72. return config
  73. Config = GSIConfig()
  74. class GSISOAPServer(GSITCPSocketServer, SOAPServerBase):
  75. def __init__(self, addr = ('localhost', 8000),
  76. RequestHandler = SOAPRequestHandler, log = 0,
  77. encoding = 'UTF-8', config = Config, namespace = None):
  78. # Test the encoding, raising an exception if it's not known
  79. if encoding != None:
  80. ''.encode(encoding)
  81. self.namespace = namespace
  82. self.objmap = {}
  83. self.funcmap = {}
  84. self.encoding = encoding
  85. self.config = config
  86. self.log = log
  87. self.allow_reuse_address= 1
  88. GSITCPSocketServer.__init__(self, addr, RequestHandler,
  89. self.config.channel_mode,
  90. self.config.delegation_mode,
  91. tcpAttr = self.config.tcpAttr)
  92. def get_request(self):
  93. sock, addr = GSITCPSocketServer.get_request(self)
  94. return sock, addr
  95. class ThreadingGSISOAPServer(ThreadingGSITCPSocketServer, SOAPServerBase):
  96. def __init__(self, addr = ('localhost', 8000),
  97. RequestHandler = SOAPRequestHandler, log = 0,
  98. encoding = 'UTF-8', config = Config, namespace = None):
  99. # Test the encoding, raising an exception if it's not known
  100. if encoding != None:
  101. ''.encode(encoding)
  102. self.namespace = namespace
  103. self.objmap = {}
  104. self.funcmap = {}
  105. self.encoding = encoding
  106. self.config = config
  107. self.log = log
  108. self.allow_reuse_address= 1
  109. ThreadingGSITCPSocketServer.__init__(self, addr, RequestHandler,
  110. self.config.channel_mode,
  111. self.config.delegation_mode,
  112. tcpAttr = self.config.tcpAttr)
  113. def get_request(self):
  114. sock, addr = ThreadingGSITCPSocketServer.get_request(self)
  115. return sock, addr