LastError - cClientWebService
Used to manually report an error after a Web Service call
Type: Procedure
Syntax
Procedure LastError
Call Example
Send LastError
Description
A web-service call, which results in an error will send the message LastError. The default behavior of LastError is to report the error if pbSuppressLastError is False, which is its default. If pbSuppressLastError is True, LastError will do nothing. If you choose to suppress the error, you will want to handle the error reporting yourself. You can check the status of your last web-service call with the peTransferStatus property. You can report any errors by setting pbSuppressLastError to False and calling LastError or by creating your own error handler. If no error occurred, LastError does nothing.
These two code samples, would do the exact same thing. If an error occurs, an error will be reported:
Set pbSuppressLastError of oWSCustomerService to False // this is actually the default
Get wsCustomerName of oWSCustomerService to sName // if an error occurred, it will be reported
Set pbSuppressLastError of oWSCustomerService to True // do not show an error automatically
Get wsCustomerName of oWSCustomerService to sName // if an error occurred, it will not be reported
Get peTransferStatus of oWSCustomerService to eTransferStatus
If (eTransferStatus<>wssOK) Begin
Set pbSuppressLastError of oWSCustomerService to False
Send LastError of oWSCustomerService // if an error occurred it will be reported
End
pbSuppressLastError and LastError can be used to perform more complicated error handling.
Set pbSuppressLastError of oWSCustomerService to True
Get wsCustomerName of oWSCustomerService to sName
Get peTransferStatus of oWSCustomerService to eTransferStatus
If (eTransferStatus=wssOK) Begin
Send AddNewName sName
End
Else Begin
// Handle soap fault errors in a special way. Report all others as errors.
If (eTransferStatus=wssSoapFault) Begin
Get TransferErrorDescription of oWSCustomerService to sErr
Send WeHadAFaultError sErr
End
Else Begin
Set pbSuppressLastError of oWSCustomerService to False
Send LastError of oWSCustomerService // this will generate an error
End
End
See Also
peTransferStatus | psFaultCode | psFaultString | peTransferStatus | TransferErrorDescription