2006-03-07 23:26:55 +01:00
|
|
|
##################################################
|
2006-03-16 00:19:00 +01:00
|
|
|
# src/gnuviechadminCommon/gnuviechadmin_services.py
|
2006-03-07 23:26:55 +01:00
|
|
|
# generated by ZSI.wsdl2python
|
|
|
|
#
|
|
|
|
#
|
|
|
|
##################################################
|
|
|
|
|
|
|
|
|
|
|
|
from gnuviechadmin_services_types import *
|
|
|
|
from gnuviechadmin_services_types import \
|
|
|
|
https___ssl_gnuviech_info_gnuviechadmin as ns1
|
|
|
|
import urlparse, types
|
|
|
|
from ZSI.TCcompound import Struct
|
|
|
|
from ZSI import client
|
|
|
|
import ZSI
|
|
|
|
|
|
|
|
class gnuviechadminInterface:
|
|
|
|
def getgnuviechadmin(self, portAddress=None, **kw):
|
|
|
|
raise NonImplementationError, "method not implemented"
|
|
|
|
|
|
|
|
|
|
|
|
class gnuviechadminLocator(gnuviechadminInterface):
|
|
|
|
gnuviechadmin_address = "https://ssl.gnuviech.info/gnuviechadmin"
|
|
|
|
def getgnuviechadminAddress(self):
|
|
|
|
return gnuviechadminLocator.gnuviechadmin_address
|
|
|
|
|
|
|
|
def getgnuviechadmin(self, portAddress=None, **kw):
|
|
|
|
return gnuviechadminSOAPSOAP(portAddress or gnuviechadminLocator.gnuviechadmin_address, **kw)
|
|
|
|
|
|
|
|
|
|
|
|
class gnuviechadminSOAPSOAP:
|
|
|
|
|
|
|
|
def __init__(self, addr, **kw):
|
|
|
|
netloc = (urlparse.urlparse(addr)[1]).split(":") + [80,]
|
|
|
|
if not kw.has_key("host"):
|
|
|
|
kw["host"] = netloc[0]
|
|
|
|
if not kw.has_key("port"):
|
|
|
|
kw["port"] = int(netloc[1])
|
|
|
|
if not kw.has_key("url"):
|
|
|
|
kw["url"] = urlparse.urlparse(addr)[2]
|
|
|
|
self.binding = client.Binding(**kw)
|
|
|
|
|
|
|
|
|
|
|
|
def Authenticate(self, request):
|
|
|
|
"""
|
|
|
|
@param: request to AuthRequest::
|
2006-03-16 00:19:00 +01:00
|
|
|
_login: str
|
|
|
|
_password: str
|
2006-03-07 23:26:55 +01:00
|
|
|
|
|
|
|
@return: response is str
|
|
|
|
"""
|
|
|
|
|
|
|
|
if not isinstance(request, AuthRequest) and\
|
|
|
|
not issubclass(AuthRequest, request.__class__):
|
|
|
|
raise TypeError, "%s incorrect request type" %(request.__class__)
|
|
|
|
kw = {}
|
|
|
|
response = self.binding.Send(None, None, request, soapaction="https://ssl.gnuviech.info/gnuviechadmin/Authenticate", **kw)
|
|
|
|
response = self.binding.Receive(AuthResponseWrapper())
|
|
|
|
|
|
|
|
if not isinstance(response, basestring):
|
|
|
|
raise TypeError, "%s incorrect response type" %(response.__class__)
|
|
|
|
return response
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class AuthRequest(ns1.LoginInfo_Dec):
|
|
|
|
if not hasattr( ns1.LoginInfo_Dec(), "typecode" ):
|
|
|
|
typecode = ns1.LoginInfo_Dec()
|
|
|
|
|
|
|
|
def __init__(self, name=None, ns=None):
|
|
|
|
ns1.LoginInfo_Dec.__init__(self, name=None, ns=None)
|
|
|
|
|
|
|
|
class AuthRequestWrapper(AuthRequest):
|
|
|
|
"""wrapper for document:literal message"""
|
|
|
|
|
|
|
|
typecode = AuthRequest( name=None, ns=None ).typecode
|
|
|
|
def __init__( self, name=None, ns=None, **kw ):
|
|
|
|
AuthRequest.__init__( self, name=None, ns=None )
|
|
|
|
|
|
|
|
class AuthResponse(ns1.AuthCode_Dec):
|
|
|
|
if not hasattr( ns1.AuthCode_Dec(), "typecode" ):
|
|
|
|
typecode = ns1.AuthCode_Dec()
|
|
|
|
|
|
|
|
def __init__(self, name=None, ns=None):
|
|
|
|
ns1.AuthCode_Dec.__init__(self, name=None, ns=None)
|
|
|
|
|
|
|
|
class AuthResponseWrapper(AuthResponse):
|
|
|
|
"""wrapper for document:literal message"""
|
|
|
|
|
|
|
|
typecode = AuthResponse( name=None, ns=None ).typecode
|
|
|
|
def __init__( self, name=None, ns=None, **kw ):
|
|
|
|
AuthResponse.__init__( self, name=None, ns=None )
|