Download files from Oracle UCM/WebCenter

Updated: Apr 25, 2020

Oracle UCM is the Oracle’s Universal Content Management application and it is now referred as Oracle WebCenter Content Server.

This application is an integral part of Oracle HCM cloud, and is been used as its content management system. WebCenter is the preferred method of file transfer for inbound and outbound integrations i.e. data loading as well as extracts. It provides improved and secured file management capabilities.

We can access this application in two ways.

1. File Import/Export UI: From Oracle cloud application go to Navigator - Tools - File Import and Export - UI to search/download/upload files from or to WebCenter.

2. Oracle WebCenter UI: Login or navigate to WebCenter UI by simply appending /cs to your application url for ex. https://<hostname>/cs .

Now I will show you how to download a CSV file from WebCenter and zip it by invoking WebCenter SOAP services from Python.

Generic Soap Service : https://<HostName>/idcws/GenericSoapPort?wsdl

Refer to Oracle WebCenter Content Generic SOAP Web Service for more info.

To download a file from WebCenter, we need the Document Name/Document ID of the file.

Use below code to download the file using Document ID.

import requests
import zipfile
import io
import csv
from os import path
import os


headers = {'content-type': 'text/xml','charset':'UTF-8'}

body="""<soapenv:Envelope xmlns:soapenv="" xmlns:ucm="">
    <ucm:GenericRequest webKey="cs">
        <ucm:Service IdcService="GET_FILE">
                <!--Zero or more repetitions:-->
                <ucm:Field name="dID">{DocID}</ucm:Field>

username = '<USERNAME>'
password = '<PASSWORD>', auth=(username, password),data=body,headers=headers)

zf = zipfile.ZipFile(io.BytesIO(response.content), 'r')
csv_file = open(filename, 'w')
writer = csv.writer(csv_file, dialect=csv.excel, delimiter=',',quotechar='"',lineterminator='\n', quoting=csv.QUOTE_MINIMAL)
for fileinfo in zf.infolist():'utf-8')
for i in range(0,len(mylist)):
    if row.strip() == "":
print(filename+' File created')

get the path to the file in the current directory
src = path.realpath(filename);
# rename the original file
# now put things into a ZIP archive
root_dir,tail = path.split(src)
# more fine-grained control over ZIP files
with zipfile.ZipFile(zipfilename, "w") as newzip:
 print('Zip file created')

If we need to download a file using Document Name, use the below request payload.

body="""<soapenv:Envelope xmlns:soapenv="" xmlns:ucm="">
    <ucm:GenericRequest webKey="cs">
        <ucm:Service IdcService="GET_FILE">
                <!--Zero or more repetitions:-->
                <ucm:Field name="dDocName">{DocName}</ucm:Field>
                <ucm:Field name="RevisionSelectionMethod">Latest</ucm:Field>
                <ucm:Field name="Rendition">Primary</ucm:Field>

How to download all the files linked to a schedule job?

For each job a MANIFEST.MF file will be created which contains all the Document ID's generated by that job, we can use that to download all the files.

Note: to make this completely automated we need to bring the Document ID of the MANIFEST.MF file.

Thanks for reading! Check out my other posts here and share, if you liked it.

1,261 views1 comment