Ejemplo n.º 1
0
    def __init__(self):
        
        self.system = SOAPpy.SOAPProxy("http://localhost:7081")
        espmlFile = "soundscape_function.xml"
		
        espmlDocObject = espml.parse(espmlFile)
        espmlDocXml = StringIO.StringIO()
        espmlDocObject.export(espmlDocXml, 0)
        r = self.system.execute(espmlDocXml.getvalue())

        espmlResponse = espml.parseString(r)
        field = espmlResponse.getField()[0]
        functions = field.getFunction()
        sessionId = None
        for f in functions:
            if f.getName() == "getSessionId":
                sessionId = f.getOutput()[0].getUri()

        if sessionId == None:
            print "No session ID received."
            sys.exit(1)
        

        #now, submit a timestamp and audio file at the same time
        espmlDocObject = espml.parse("soundscape_function2.xml")
        field = espmlDocObject.getField()[0]
        functions = field.getFunction()
        for f in functions:
            if f.getName() == "uploadLocation":
                f.addParameter(espml.parameter(name="sessionId", value=sessionId))
                f.addParameter(espml.parameter(name="timestamp", value=timestamp))
                f.addParameter(espml.parameter(name="location", value=location))
            if f.getName() == "uploadMedia":
                f.addParameter(espml.parameter(name="sessionId", value=sessionId))
                f.addParameter(espml.parameter(name="timestamp", value=timestamp))
                f.addParameter(espml.parameter(name="mediaFile", value=base64.b64encode(mediaFileString)))

        espmlDocXml = StringIO.StringIO()
        espmlDocObject.export(espmlDocXml, 0)
        #print espmlDocXml.getvalue()

        r = self.system.execute(espmlDocXml.getvalue())
Ejemplo n.º 2
0
        def processRequest(self, dict, baseFunctionCallFile):
                print "Content-Type: text/html\n"
                print "<html><head><title>functionCall</title></head>"
                print "<body>"
                print "<pre>"

		#print self.dict

		tempKey = 0
		espmlDocObject = espml.parse(baseFunctionCallFile)

		if(dict.has_key('system')):
			if(dict.has_key('system')):
				espmlDocObject.setId(str(dict['system']))

		for field in espmlDocObject.getField():
			if(dict.has_key('field')):
				field.setId(int(dict['field']))
				if(dict.has_key('platform')):
					pass
				else:
					field.addFunction(espml.function(dict['name'], 'General Function Description'))				
					for key in dict.keys():
						if((key != 'system') and (key != 'name') and (key != 'platform') and (key != 'sensor') and (key != 'field')):
							for function in field.getFunction():
								param = espml.parameter(str(key))
								param.setValue(str(dict[key]))
                               	                                function.addParameter(param)
			for platform in field.getPlatform():
				if(dict.has_key('platform')):
					platform.setId(int(dict['platform']))
                                	if(dict.has_key('sensor')):     
                                        	pass
                                	else:
        		                        platform.addFunction(espml.function(dict['name'], 'General Function Description'))
                		                for key in dict.keys():
                        		                if((key != 'system') and (key != 'name') and (key != 'platform') and (key != 'sensor') and (key != 'field')):
                                		                for function in platform.getFunction():
									param = espml.parameter(str(key))
									param.setValue(str(dict[key]))
                                	                                function.addParameter(param)
				for sensor in platform.getSensor():
					if(dict.has_key('sensor')):
						sensor.setId(int(dict['sensor']))
	        	                        sensor.addFunction(espml.function(dict['name'], 'General Function Description'))
        	                                for key in dict.keys():
                	                                if((key != 'system') and (key != 'name') and (key != 'platform') and (key != 'sensor') and (key != 'field')):
                        	                                for function in sensor.getFunction():
									param = espml.parameter(str(key))
									param.setValue(str(dict[key]))
                                	                                function.addParameter(param)


                espmlDocXml = StringIO.StringIO()
                espmlDocObject.export(espmlDocXml, 0)
                                
                #print espmlDocXml.getvalue()
		#print espmlDocObject.getId()

		system = SOAPpy.SOAPProxy(espmlDocObject.getId())
		functionOutputXML = system.execute(espmlDocXml.getvalue())

		espmlDocObject = espml.parseString(functionOutputXML)

		for field in espmlDocObject.getField():
			for function in field.getFunction():
				print 'Function:', function.getName()
				for output in function.getOutput():
					print 'Type:', output.getType()
					if((str(output.getType()) == "OK") or (str(output.getType()) == "ERROR")):
						print 'Response: ' + str(output.getUri())				
					else:
						print 'URI:' + '<a href="' + str(output.getUri()) + '">' + str(output.getUri()) + '</a>'
			for platform in field.getPlatform():
	                        for function in platform.getFunction():
					print 'Function:', function.getName()
                	                for output in function.getOutput():
						print 'Type:', output.getType()
	                                        if((str(output.getType()) == "OK") or (str(output.getType()) == "ERROR")):
        	                                        print 'Response: ' + str(output.getUri())
                	                        else:
                        	                        print 'URI:' + '<a href="' + str(output.getUri()) + '">' + str(output.getUri()) + '</a>'
				for sensor in platform.getSensor():
		                        for function in sensor.getFunction():
						print 'Function:', function.getName()
        	                	        for output in function.getOutput():
							print 'Type:', output.getType()
		                                        if((str(output.getType()) == "OK") or (str(output.getType()) == "ERROR")):
                		                                print 'Response: ' + str(output.getUri())
                                		        else:
                                                		print 'URI:' + '<a href="' + str(output.getUri()) + '">' + str(output.getUri()) + '</a>'

                print "</pre>"
                print "</body>"
                print "</html>"
Ejemplo n.º 3
0
    def __init__(self):
        
        self.system = SOAPpy.SOAPProxy("http://*****:*****@ee.ucla.edu"))
		f.addParameter(espml.parameter(name="password", value="intel"))
                f.addParameter(espml.parameter(name="overwriteData", value="1"))
                f.addParameter(espml.parameter(name="dataType", value="xml"))  
                f.addParameter(espml.parameter(name="dataFile", value=dataFileValue))
            if f.getName() == "performQuery":
                f.addParameter(espml.parameter(name="dataType", value="xml"))
                f.addParameter(espml.parameter(name="queryString", value="SELECT+*+FROM+p_12_data"))

        espmlDocXml = StringIO.StringIO()
        espmlDocObject.export(espmlDocXml, 0)
        print espmlDocXml.getvalue()

        r = self.system.execute(espmlDocXml.getvalue())
Ejemplo n.º 4
0
    def processRequest(self, dict, baseFunctionCallFile):
        print "Content-Type: text/html\n"
        print "<html><head><title>functionCall</title></head>"
        print "<body>"
        print "<pre>"

        #print self.dict

        tempKey = 0
        espmlDocObject = espml.parse(baseFunctionCallFile)

        if (dict.has_key('system')):
            if (dict.has_key('system')):
                espmlDocObject.setId(str(dict['system']))

        for field in espmlDocObject.getField():
            if (dict.has_key('field')):
                field.setId(int(dict['field']))
                if (dict.has_key('platform')):
                    pass
                else:
                    field.addFunction(
                        espml.function(dict['name'],
                                       'General Function Description'))
                    for key in dict.keys():
                        if ((key != 'system') and (key != 'name')
                                and (key != 'platform') and (key != 'sensor')
                                and (key != 'field')):
                            for function in field.getFunction():
                                param = espml.parameter(str(key))
                                param.setValue(str(dict[key]))
                                function.addParameter(param)
            for platform in field.getPlatform():
                if (dict.has_key('platform')):
                    platform.setId(int(dict['platform']))
                    if (dict.has_key('sensor')):
                        pass
                    else:
                        platform.addFunction(
                            espml.function(dict['name'],
                                           'General Function Description'))
                        for key in dict.keys():
                            if ((key != 'system') and (key != 'name')
                                    and (key != 'platform')
                                    and (key != 'sensor')
                                    and (key != 'field')):
                                for function in platform.getFunction():
                                    param = espml.parameter(str(key))
                                    param.setValue(str(dict[key]))
                                    function.addParameter(param)
                for sensor in platform.getSensor():
                    if (dict.has_key('sensor')):
                        sensor.setId(int(dict['sensor']))
                        sensor.addFunction(
                            espml.function(dict['name'],
                                           'General Function Description'))
                        for key in dict.keys():
                            if ((key != 'system') and (key != 'name')
                                    and (key != 'platform')
                                    and (key != 'sensor')
                                    and (key != 'field')):
                                for function in sensor.getFunction():
                                    param = espml.parameter(str(key))
                                    param.setValue(str(dict[key]))
                                    function.addParameter(param)

        espmlDocXml = StringIO.StringIO()
        espmlDocObject.export(espmlDocXml, 0)

        #print espmlDocXml.getvalue()
        #print espmlDocObject.getId()

        system = SOAPpy.SOAPProxy(espmlDocObject.getId())
        functionOutputXML = system.execute(espmlDocXml.getvalue())

        espmlDocObject = espml.parseString(functionOutputXML)

        for field in espmlDocObject.getField():
            for function in field.getFunction():
                print 'Function:', function.getName()
                for output in function.getOutput():
                    print 'Type:', output.getType()
                    if ((str(output.getType()) == "OK")
                            or (str(output.getType()) == "ERROR")):
                        print 'Response: ' + str(output.getUri())
                    else:
                        print 'URI:' + '<a href="' + str(
                            output.getUri()) + '">' + str(
                                output.getUri()) + '</a>'
            for platform in field.getPlatform():
                for function in platform.getFunction():
                    print 'Function:', function.getName()
                    for output in function.getOutput():
                        print 'Type:', output.getType()
                        if ((str(output.getType()) == "OK")
                                or (str(output.getType()) == "ERROR")):
                            print 'Response: ' + str(output.getUri())
                        else:
                            print 'URI:' + '<a href="' + str(
                                output.getUri()) + '">' + str(
                                    output.getUri()) + '</a>'
                for sensor in platform.getSensor():
                    for function in sensor.getFunction():
                        print 'Function:', function.getName()
                        for output in function.getOutput():
                            print 'Type:', output.getType()
                            if ((str(output.getType()) == "OK")
                                    or (str(output.getType()) == "ERROR")):
                                print 'Response: ' + str(output.getUri())
                            else:
                                print 'URI:' + '<a href="' + str(
                                    output.getUri()) + '">' + str(
                                        output.getUri()) + '</a>'

        print "</pre>"
        print "</body>"
        print "</html>"
Ejemplo n.º 5
0
    def __init__(self):

        self.system = SOAPpy.SOAPProxy("http://*****:*****@ee.ucla.edu"))
                f.addParameter(espml.parameter(name="password", value="intel"))
                f.addParameter(espml.parameter(name="overwriteData",
                                               value="1"))
                f.addParameter(espml.parameter(name="dataType", value="xml"))
                f.addParameter(
                    espml.parameter(name="dataFile", value=dataFileValue))
            if f.getName() == "performQuery":
                f.addParameter(espml.parameter(name="dataType", value="xml"))
                f.addParameter(
                    espml.parameter(name="queryString",
                                    value="SELECT+*+FROM+p_12_data"))

        espmlDocXml = StringIO.StringIO()
        espmlDocObject.export(espmlDocXml, 0)
        print espmlDocXml.getvalue()

        r = self.system.execute(espmlDocXml.getvalue())