Ignore:
Timestamp:
16/06/06 14:17:07 (14 years ago)
Author:
astephen
Message:

Updated lots of stuff to get zsi working with version 2.0 or lower.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI04-geosplat/trunk/gss/bin/GSWSInterface.py

    r798 r1210  
    5757import re 
    5858import os, types 
     59from ZSI import dispatch 
     60#from ZSI.version import Version 
     61Version=(2,0,0)#(1,6,1) # of client ZSI - not this one! 
     62# Sort the ZSI version out 
     63zsiversion=float("%s.%s" % Version[:2]) 
    5964 
    6065# Import package modules 
     
    7782        args[key]=value 
    7883    return GSController(args) 
    79  
    80  
    81  
    82 def startSession(username=None, password=None, secureToken=None): 
     84                                                    
     85 
     86def startSession(username="undefined", password="undefined", secureToken="undefined"): 
    8387    """ 
    8488    Logs a user in and supplies them with a session ID as well 
    8589    as an encoded security token. The session ID connects them to their 
    8690    current request serverside whilst the security token is used to  
    87     authorise their access. Also takes the list of files being provided 
    88     by the user for visualising from. 
     91    authorise their access.  
    8992    Returns: sessionID, secureToken 
    9093    """ 
     
    9295    args={"username":deUnicodeObject(username), "password":deUnicodeObject(password),  
    9396             "secureToken":deUnicodeObject(secureToken)}        
    94  
    95     controller=GSController(args) 
    96  
    97     if controller.error!=None: 
    98         return controller.error 
     97    try: 
     98        controller=GSController(args) 
     99    except Exception, error: 
     100        return str(error)            
    99101         
    100102    sessionID=controller.bag["sessionID"] 
    101103    secureToken=controller.secureToken 
    102  
    103     return [[sessionID], [secureToken]] 
    104      
     104    # Have to return list of lists for ZSI to work (?!) 
     105 
     106    if zsiversion<2.0: 
     107        sessionID=[sessionID] 
     108        secureToken=[secureToken] 
     109    print "Sending back:", sessionID, secureToken 
     110     
     111    return [sessionID, secureToken] 
     112 
    105113 
    106114def provideFileURIs(sessionID, secureToken, fileURIList): 
     
    138146        
    139147         
    140 def getOptions(sessionID, secureToken=None, optionCategoryRequested=None): 
     148def getOptions(sessionID, secureToken="undefined", optionCategoryRequested="undefined"): 
    141149    """ 
    142150    Returns a category description of the next set of options (or the option category  
     
    157165    args={"sessionID":sessionID, "secureToken":secureToken, "optionCategoryRequested":optionCategoryRequested} 
    158166  
    159     controller=GSController(args) 
    160     if controller.error!=None: 
    161         return controller.error         
     167    try: 
     168        controller=GSController(args) 
     169    except Exception, error: 
     170        return str(error)    
    162171 
    163172    optionsObject=controller.options 
     
    176185    print "Method called: selectOptions\n"     
    177186    print sessionID 
    178      
    179      
    180187     
    181188    args={"sessionID":sessionID} 
     
    213220     
    214221     
    215 def isComplete(sessionID, secureToken=None): 
     222def isComplete(sessionID, secureToken="undefined"): 
    216223    """ 
    217224    Returns 1 if the request is complete (i.e. ready to create output file(s)) 
     
    232239     
    233240 
    234 def createOutput(sessionID, secureToken=None): 
     241def createOutput(sessionID, secureToken="undefined"): 
    235242    """ 
    236243    Creates the outputs specified by user selections. It writes these files 
     
    272279     
    273280 
    274 def newSession(sessionID, secureToken=None): 
     281def newSession(sessionID, secureToken="undefined"): 
    275282    """ 
    276283    Deletes content of current request. 
     
    280287    args={"sessionID":sessionID, "secureToken":secureToken, "clearSession":"clearSession"} 
    281288      
    282     controller=GSController(args) 
    283     if controller.error!=None: 
    284         return controller.error     
     289    try: 
     290        controller=GSController(args) 
     291    except Exception, error: 
     292        return str(error)  
    285293     
    286294    secureToken=controller.secureToken 
     
    288296 
    289297         
    290 def summariseRequest(sessionID, secureToken=None): 
    291     """ 
     298def summariseRequest(sessionID, secureToken="undefined"): 
     299    """find /home/as56/abstractWebService/releases/ -type d -name .svn -exec rm -rf {} 
     300\; # is untested 
     301 
    292302    Returns a listing of the current request in a string and a security token. 
    293303    """     
     
    337347 
    338348 
    339 def getDataSubsetSpecifier(sessionID, secureToken=None): 
    340     """ 
    341     Returns the dataSubsetSpecifier XML document (which might be S-metadata) 
    342     required by a Delivery Service to describe the subset requested, and a 
    343     security token. 
    344     """ 
    345     print "Method called: getDataSubsetSpecifier\n" 
    346     args={"sessionID":sessionID, "secureToken":secureToken} 
    347     controller=GSController(args) 
    348     secureToken=controller.secureToken 
    349     sessionObj=controller.bag 
    350     dataSubsetSpecifierXMLString=dxrmlHandler.DXRMLGenerator(sessionObj).xmlString 
    351     print dataSubsetSpecifierXMLString 
    352     return [[dataSubsetSpecifierXMLString], [secureToken]] 
    353  
    354  
    355 def getExtractionCosts(sessionID, secureToken=None): 
     349def getExtractionCosts(sessionID, secureToken="undefined"): 
    356350    """ 
    357351    Returns an estimated duration for the creation of the output data and the  
     
    373367    Serve all functions as Web Service methods. 
    374368    """ 
    375     print "Importing SOAP library (ZSI)." 
    376     from ZSI import dispatch 
    377369    print "Setting up server" 
    378370    portNumber=SOAP_SERVER_PORT 
    379371    print "Serving Web Service on port: %s" % portNumber     
    380     dispatch.AsServer(port=portNumber)    
    381  
    382  
    383  
     372    dispatch.AsServer(port=portNumber, rpc=True) 
     373 
     374 
     375 
Note: See TracChangeset for help on using the changeset viewer.