>DEFINE CLASS BaseCom AS Session > PROCEDURE Init > SYS(2335 ,0) && Turn unattended mode on > ENDPROC > > PROCEDURE Error(nError, cMethod, nLine) > LOCAL lcMessage AS String > lcMessage = 'Error: ' + TRANSFORM(nError) + ' - ' + MESSAGE() > * > * If we have an error call COMRETURNERROR this will raise an error on SOAP > * that will raise an error on the client. > * > COMRETURNERROR(This.Class, lcMessage) > ENDPROC >ENDDEFINE > >DEFINE CLASS FileService AS BaseCom OLEPUBLIC > FUNCTION GetFile(cFileName AS String) AS String > IF FILE(cFileName) > RETURN FILETOSTR(cFileName) > ELSE > COMRETURNERROR('FileService', 'File ' + cFileName + " doesn't exist") > ENDIF > ENDFUNC > > FUNCTION SaveFile(cFileName AS String, cFileStr AS String, lOverwrite AS Boolean) AS Boolean > > IF !FILE(cFileName) OR lOverwrite > STRTOFILE(cFileStr, cFileName) > RETURN FILE(cFileName) > ELSE > COMRETURNERROR('FileService', 'File ' + cFileName + ' already exist') > ENDIF > ENDFUNC > * > * This lines are only taken in considuration > * if this is called over COM and not over SOAP. > * for SOAP calls all the parameters must be pass > * > DIMENSION SaveFile_COMATTRIB[5] > SaveFile_COMATTRIB[3] = 'SaveFile' && Proper capitalization > SaveFile_COMATTRIB[5] = 2 && Specifie the number of required parameters >ENDDEFINE >