Untitled

 avatar
unknown
python
3 years ago
1.2 kB
13
Indexable
'''
https://docs.oracle.com/middleware/1221/biee/BIEIT/methods.htm
'''
from suds.client import Client


# Logon
client = Client('http://ol7OAS:9502/analytics-ws/saw.dll/wsdl/v7')
sessionid = client.service['SAWSessionService'].logon('weblogic','welcome1')

# Params
reportPath = {
    'reportPath': '/users/weblogic/Prueba_Web_Services'  # Ruta al informe
}
XMLQueryExecutionOptions = {
    'async':False,
    'maxRowsPerPage':150,
    'refresh':True,
    'presentationInfo':True,
    'type':'test'
}
reportParams = {
    'filterExpressions': [],
    'variables': [{'name': 'brand', 'value': 'FunPod'}],  # Variables del informe
    'nameValues': None,
    'templateInfos': None,
    'viewName': None  # Nombre de la vista del informe e.j.: "tableView!1" (None=Todas las columnas)
}

# Execute
service = client.service['XmlViewService']
result = service.executeXMLQuery(reportPath, 'SAWRowsetSchemaAndData', XMLQueryExecutionOptions, reportParams, sessionid)

# Fetch
dataset = [result.rowset]
while not result.finished:
    result = service.fetchNext()
    dataset.append(result.rowset)

# Save
with open('export_'+ result.queryID +'.xml', 'w', encoding='utf-8') as f:
    f.writelines(dataset)
Editor is loading...