privatestaticfinalStringIDC_SERVICE="IdcService";privatestaticfinalStringFORCE_DOWNLOAD_STREAM_TO_FILE_PATH="ForceDownloadStreamToFilepath";privatestaticfinalStringGET_FILE="GET_FILE";privatestaticfinalStringD_ID="dID";publicFileServiceexecuteFileService(finalDataBinderserviceBinder,finalServicem_service)throwsDataException,ServiceException{finalStringserviceName=serviceBinder.getLocal(IDC_SERVICE);finalServiceDataserviceData=ServiceManager.getFullService(serviceName);finalFileServiceservice=(FileService)ServiceManager.createService(serviceData.m_classID,m_service.getWorkspace(),m_service.getOutput(),serviceBinder,serviceData);service.setConditionVar(FORCE_DOWNLOAD_STREAM_TO_FILE_PATH,true);service.initDelegatedObjects();m_service.getRequestImplementor().doRequestInternalEx(service,m_service.getUserData(),false);returnservice;}publicvoidrunGetFile(){DataBinderserviceBinder=newDataBinder();serviceBinder.putLocal(IDC_SERVICE,GET_FILE);serviceBinder.putlocal(D_ID,"923415");executeFileService(serviceBinder,m_service);finalDataStreamWrapperstreamWrapper=m_service.getDownloadStream(false);finalStringfilePath=streamWrapper.m_filePath;// Do whatever we want with the file// Remove this zip file after we exit this service (this assumes we did what we wanted with the file above)m_binder.m_tempFiles.remove(zipFilePath);}
https://jonathanhult.com/blog/2015/09/execute-get_file-from-servicehandler-webcenter-content/