com.APNS.DecodeError

Decodes content of BYTE data returned from the APNS server in case of error.

Syntax

com.APNS.DecodeError(
   data BYTE)
  RETURNING uuid STRING, error INTEGER
  1. data is the BYTE variable containing the error data. This BYTE variable must be located IN MEMORY.
  2. uuid is a Base64 encoded string containing the push notification identifier.
  3. error is the APNS error code returned by the server.

Usage

This method decodes the content of the BYTE variable passed as a parameter and received as response for a push notification message in the event of an error from the APNs server.

Note: This BYTE variable must be located IN MEMORY.

The uuid is a binary value that identifies the push notification message. It is returned as a Base64-encoded string.

The error returned value defines the APNs error code. For example, error will be set to 10 if the APNs server was shutdown. See the Apple Push Notification Service error reference for more details.

In the case of a decoding error, the method will raise the exception -15566, with details in the SQLCA.SQLERRM register.

Example

DEFINE error_data BYTE,
       uuid STRING,
       error INTEGER

    LOCATE error_data IN MEMORY

    -- Send push notification message TCP request
    ...
    CALL req.doDataRequest(data)
    LET resp = req.getResponse()
    TRY
        CALL resp.getDataResponse(error_data)
        CALL com.APNS.DecodeError(error_data)
             RETURNING uuid, ecode
    ... 

For a complete example, see APNs push provider.