-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathws_execution_engine.py
49 lines (41 loc) · 1.61 KB
/
ws_execution_engine.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import dictionary
import json
try:
EX_SERVICE_DIC_ONTO_WSDL = dictionary.SERVICE_DIC_ONTO_WSDL
except Exception as inst:
print("out")
print(inst)
####
# ABU : this function will be unnecesary. We can use func execute_single_operation for all single operation. Just update the change name and parameters in app_ws_execution
####
def execute_name_extraction_operation(OperationName, InputParams, OutputParams):
try:
print("executing name_extraction operation..")
result = EX_SERVICE_DIC_ONTO_WSDL[OperationName]['execution.call'](InputParams)
print("got result")
json_data = json.loads(result)
what_want_to_get = EX_SERVICE_DIC_ONTO_WSDL[OperationName]['outputs']['resource_SetOfScientificNames']
print(json_data[what_want_to_get])
return json_data
except Exception as inst:
print("Error : ")
print(inst)
return None
def execute_single_operation(OperationName, InputParams, OutputParams):
try:
print("----------------------------")
print("---- Execute Service : %s" %(OperationName))
print("---- Input Params : ")
print(InputParams)
result = EX_SERVICE_DIC_ONTO_WSDL[OperationName]['execution.call'](InputParams)
json_data = json.loads(result)
what_want_to_get = EX_SERVICE_DIC_ONTO_WSDL[OperationName]['outputs'][OutputParams[0]]
print("---- Ouput data : ")
print(json_data[what_want_to_get])
return json_data
except Exception as inst:
print("Error : ")
print(inst)
return None
def execution_a_workflow():
return None