Changeset 1763


Ignore:
Timestamp:
24/11/06 14:01:38 (13 years ago)
Author:
spascoe
Message:

Converted serverConfig.py into server.conf. Modified DXWSInterface to
use server.conf and made it ready for moving into the package
heirarchy. Deleted an alternative version of DXWSInterface.

Location:
TI03-DataExtractor/branches/repackaging/server/dxs
Files:
1 added
1 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • TI03-DataExtractor/branches/repackaging/server/dxs/bin/DXWSInterface.py

    r1715 r1763  
    3333import urllib 
    3434import os, types 
    35  
    36 # Get configuration file as first argument 
    37 args=sys.argv[1:] 
    38 if len(args)!=1: 
    39     print "ERROR: please provide the location of the configuration file as the only argument to this script." 
    40     sys.exit() 
    41      
    42 configFile=args[0] 
    43 configPath, configFilename=os.path.split(configFile) 
    44 sys.path.insert(0, configPath) 
    45 exec ("from %s import *" % configFilename[:-3]) 
    46  
    47 # Path for virtual variables 
    48 extraPath=os.path.split(configPath)[0] 
    49 sys.path.insert(0, extraPath) 
    50  
    51 from ZSI import dispatch 
    52 #from ZSI.version import Version 
    53 Version=(2,0,0)#(1,6,1) # of client ZSI - not this one! 
    54 # Sort the ZSI version out 
    55 zsiversion=float("%s.%s" % Version[:2]) 
     35from ConfigParser import SafeConfigParser 
    5636 
    5737# Import package modules 
    58 from pydxs.common import * 
    59 from pydxs.DXController import * 
    60 #from pydxs.serverConfig import * 
    61 from pydxs.DXRMLHandler import * 
    62 from pydxs.DXErrors import * 
     38from ndg.dx.server.common import * 
     39from ndg.dx.server.DXController import * 
     40from ndg.dx.server.DXRMLHandler import * 
     41from ndg.dx.server.DXErrors import * 
    6342 
    6443# Set global variables 
    6544timePattern=re.compile("(\d{4})-(\d{1,2})-(\d{1,2}).(\d{1,2}):(\d{1,2}):(\d{1,2}(\.\d+)?)") 
    6645           
     46# Create config object 
     47config = SafeConfigParser() 
     48configSection = 'ndg.dx.server' 
    6749 
    6850def callControllerDirectly(argList): 
     
    136118    # Have to return list of lists for ZSI to work (?!) 
    137119 
    138     if zsiversion<2.0: 
    139         sessionID=[sessionID] 
    140         secureToken=[secureToken] 
    141120    print sessionID, secureToken 
    142121    return [sessionID, secureToken] 
     
    273252    pathList=controller.bag["outputFilePaths"] 
    274253 
    275     if zsiversion<2.0: 
    276         pathList=[pathList] 
    277         secureToken=[secureToken] 
    278254 
    279255    return [pathList, secureToken] 
     
    420396    print "Returning...", [estimatedDuration, estimatedVolume, secureToken] 
    421397 
    422     if zsiversion<2.0: 
    423         estimatedDuration=[estimatedDuration] 
    424         estimatedVolume=[estimatedVolume] 
    425         secureToken=[secureToken] 
    426398 
    427399    return [estimatedDuration, estimatedVolume, secureToken]        
     
    498470 
    499471if __name__=="__main__":  
    500     # Serve all functions as Web Service methods. 
    501      
     472 
     473def main(args=None): 
     474    if not args: 
     475        args = sys.argv[1:] 
     476 
     477    config.read(args[0]) 
     478     
     479    # Serve all functions as Web Service methods.     
    502480    print "Setting up server" 
    503     portNumber=SOAP_SERVER_PORT 
     481    portNumber=config.getint(configSection, SOAP_SERVER_PORT) 
    504482    print "Serving Web Service on port: %s" % portNumber     
    505483    dispatch.AsServer(port=portNumber, rpc=True)    
Note: See TracChangeset for help on using the changeset viewer.