peTransferStatus - cClientWebService
Returns the status of the last web-service call
Type: Property
Access: Read/Write
Data Type: Integer
Parameters: None
Syntax
Property Integer peTransferStatus
| Access Type | Syntax |
|---|---|
| Read Access: | Get peTransferStatus to IntegerVariable |
| Write Access: | Set peTransferStatus to IntegerVariable/Value |
Description
peTransferStatus returns the status of the last web-service call. You should use this value to determine if your web-service invocation was successful.
The possible return values are:
| Constant | Meaning |
|---|---|
| wssOk | Request succeeded |
| wssHttpRequestFailed | Http request failed |
| wssBadRequest | Bad or missing data sent |
| wssInvalidContentType | Invalid contentType received |
| wssNoData | No data was received |
| wssNotXml | Received data not in proper XML format |
| wssNotSoap | Received XML data not in proper Soap format |
| wssInvalidSoap | Received SOAP data not formatted according to service description |
| wssSoapFault | Soap Fault Returned |
| wssError | unspecified error |
| wssInvalidDataForType | Attempt to move data from XML to Struct failed. |
| wssCouldNotResolveHRef | we had an href and we could not find the Id data for it |
If a SOAP fault occurs the fault-code is returned in psFaultCode and the fault-description returned in psFaultString.
Normally, a failed web-service request will result in an error message. In this example, we assume that an error will have already been reported and that we are using the status to handle the call after a success or an error.
Get wsCustomerName of oWSCustomerService to sName
Get peTransferStatus of oWSCustomerService to eTransferStatus
If (eTransferStatus=wssOK) Begin
Send AddNewName sName
End
Else Begin
Send TrySomethingElse
End
The wssHttpRequestFailed Status
If the web-service response was wssHttpRequestFailed, this indicates that there is something wrong with your HTTP transfer. If you need to determine more detailed information about the HTTP error you can use the phoHttp property to access the cXmlHttpTransfer object used for the transfer. This object, which is a sub-class of the cHttpTransfer class, has interfaces (peXmlTransferStatus, LastErrorCode, ResponseStatusCode) which can be used to get more information about an HTTP transfer failure.
Disabling Automatic Error Reporting
You can choose to disable automatic error reporting by setting pbSuppressLastError to True. In such a case, you must handle the error report yourself.
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
Send LastError of oWSCustomerService // this will generate an error
End
End
See Also
psFaultCode | psFaultString | pbSuppressLastError | TransferErrorDescription | LastError