Condizioni di notifica
Evento notificato dai web service quando viene eseguita un'operazione di lettura o scrittura di file.
- Se viene eseguito il metodo SendFile o ReceiveFile su un client.
Utilizzo consigliato
Normalmente viene utilizzato per decidere se un web service permette l'invio e/o la ricezione di file da client remoti.
Argomenti
| Operation | Parametro di tipo stringa che indica il tipo di operazione che viene eseguita sul web service. Vale "RECEIVE" se l'operazione è la ricezione di un file da parte di un client; vale "SEND" se l'operazione è la richiesta di un file da parte di un client |
| File Name | Parametro di tipo stringa di Input/Output che indica il percorso del file |
| Allow | Parametro di tipo boolean di Input/Output che indica se l'operazione è permessa |
Esempio di codice
// *****************************************************************************************************************
// Fired by a web service when a file operation is executed (when using SendFile and ReceiveFile methods)
// *****************************************************************************************************************
event MainClass.OnFileOperation(
string Operation // Indicates which operation is executed (SEND/RECEIVE)
inout string FileName // Path of the file involved in the operation
inout int Allow // Tells the system if the operation is allowed
)
{
// Allow the operation only if the file is contained in my DATA directory
string fPath = left(FileName, length(NPQ04845WS.path()))
string myPath = NPQ04845WS.path()
if (lower(fPath) == lower(myPath))
Allow = true
}
// Fired by a web service when a file operation is executed (when using SendFile and ReceiveFile methods)
// *****************************************************************************************************************
event MainClass.OnFileOperation(
string Operation // Indicates which operation is executed (SEND/RECEIVE)
inout string FileName // Path of the file involved in the operation
inout int Allow // Tells the system if the operation is allowed
)
{
// Allow the operation only if the file is contained in my DATA directory
string fPath = left(FileName, length(NPQ04845WS.path()))
string myPath = NPQ04845WS.path()
if (lower(fPath) == lower(myPath))
Allow = true
}
- E' possibile cambiare il valore del parametro File Name all'interno del file per fornire al chiamante un file differente (qualora l'operazione sia SEND) o per salvare altrove il file ricevuto (qualora l'operazione sia RECEIVE).
- Se non viene implementato l'evento o se non viene valorizzata il parametro Allow l'operazione viene rifiutata.
Ultima modifica: 20/11/2020 / Validità: da 20.5.8000
evento