Python Web Service http://pywebsvcs.sourceforge.net <http://pywebsvcs.sourceforge.net/> : It is a library for developing web services. The libraries import protocols for SOAP, WSDL, and others. SOAPpy is the older implementation of this. This is the SOAP version used by pyGlobus.

In Cleo we used SOAPpy for Meta Data DB access. The code snippet looks like:

import os, sys, string, re, time
import SOAPpy

class CLEO_Services:
    def __init__(self):
        CLEO_wsdl      = 'http://cougar.cs.cornell.edu/CLEO/CLEO_WS.asmx?WSDL'
        CLEO_namespace = 'http://cleo.lepp.cornell.edu/CLEO'
        config         = SOAPpy.SOAPConfig ()
        config.debug   = 0
        config.buildWithNamespacePrefix = False

        self.proxy = SOAPpy.WSDL.Proxy(CLEO_wsdl,config,namespace=CLEO_namespace,noroot=1)

        meths = self.proxy.methods.values()
        for m in meths:
            m.namespace = CLEO_namespace

    def GetRuns(self,datasetName,energy=''):
        dict  = self.proxy.GetRuns(Dataset_Name=datasetName,Energy_Range_Name=energy)
        returnList = dict.__dict__.items()
        # returnList consists of set of tuples:
        # type, keyVal, ns, name, typed, cache, data, keyord, attrs
        retType, runList = returnList[1]
        return runList

    def GetDatasetNames(self):
        dict  = self.proxy.GetDatasetNames()
        returnList = dict.__dict__.items()
        # returnList consists of set of tuples:
        # type, keyVal, ns, name, typed, cache, data, keyord, attrs
        retType, runList = returnList[1]
        return runList

    def GetEnergyRangeNames(self):
        dict  = self.proxy.GetEnergyRangeNames()
        returnList = dict.__dict__.items()
        # returnList consists of set of tuples:
        # type, keyVal, ns, name, typed, cache, data, keyord, attrs
        retType, runList = returnList[1]
        return runList

    def printSOAPMethods(self):
        print '%d methods in WSDL:' % len(self.proxy.methods) + '\n'
        for key in self.proxy.methods.keys():
           print key
        print

-- ValentinKuznetsov - 05 May 2006

This topic: HEP/SWIG > WebHome > CmsDbs > WebServicesTools > PythonWebService
Topic revision: 05 May 2006, ValentinKuznetsov
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding CLASSE Wiki? Send feedback