[Cover] [Previous Section] [Next Section] [Index]
Current chapter: COM Notification Library Reference
Section 29 out of 79 total sections
, Section 4 out of 5 sections in this chapter
Non-secure notification (Ntfn3Client and NtfnClient) class methods
This section describes the methods provided by the Ntfn3Client and NtfnClient classes, which allow you to send non-secure notifications. If you are sending notifications to a 3.0 (or later) UP.Link server, use the Ntfn3Client class. The UP.SDK includes the NtfnClient class only for backward compatibility. Use it only if you need to send notifications to 2.0 UP.Link servers.
The Ntfn3Client class is a superset of the NtfnClient class. Specifically, it adds the following methods, which are not provided in the NtfnClient class:
NtfnPostAlertAndInvalURL()
NtfnRemoveAlertFromInbox()
NtfnSetCharset()
NtfnGetCharset()
NtfnPostCacheOp()
NtfnPush()
NtfnClearPending()
The Ntfn3Client and Ntfn3Client classes use a non-secure transport protocol based on HTTP.
NtfnClearPending
Deletes all pending notifications for a subscriber that prefix-match a specified URL.
ClearPending() deletes pending notifications only for the HDML service that is calling it. Notifications from other services are not affected.
To delete individual notifications, use NtfnDelete, NtfnDeletePrefetch, NtfnDeleteAlert. For more information, see NtfnDelete, NtfnDeletePrefetch, and NtfnDeleteAlert.
Visual Basic Synopsis
Dim subs As String
Dim url As String
Dim ntfn As New Ntfn3Client
Dim lngResult As Long
. . .
ntfn.NtfnClearPending subs, url
lngResult = ntfn.NtfnGetLastResult
Visual C++ Synopsis
#include "notify.h"
. . .
OLECHAR *subs;
OLECHAR *url;
HRESULT result;
INtfn3Client *ntfn;
. . .
result = ntfn->NtfnClearPending(subs, url);
Perl Synopsis
use Ole;
. . .
$ntfn = CreateObject OLE 'Ntfn3Client.Ntfn3Client.1';
. . .
$ntfn->NtfnClearPending($subs, $url);
$result = $ntfn->NtfnGetLastResult();
Arguments
subs
|
A null-terminated string containing the ID of the subscriber to clear notifications for. For example:
1234567-123_uplink.foo.com
|
url
|
A null-terminated string containing the base URL of the notifications to be deleted.
|
Returns
If you use C++ to call NtfnClearPending, it returns -1 or one of the constants listed in the table below to indicate the HTTP status of the request.
To determine whether a NtfnClearPending call has succeeded with Perl or Basic, call NtfnGetLastResult. NtfnGetLastResult returns -1 or one of the HTTP status codes listed below.
IMPORTANT
If a notification call returns a -1 error value, this indicates a general I/O failure has occured. The most common cause of this error is that a corporate firewall is blocking the destination notification port.
|
Constant
|
Value
|
Description
|
CHTTPStatusNoContent
|
204
|
Success: the request to clear pending notifications was received and was valid. If there were any pending notifications for the subscriber, they were cleared.
Note that CHTTPStatusNoContent is returned if the request was valid, but there were no pending notifications to clear.
|
CHTTPStatusBadRequest
|
400
|
Failure: the request was malformed in some way.
The most common cause is an invalid subscriber ID. This code is also returned if the URL is empty or malformed.
|
CHTTPStatusForbidden
|
403
|
Failure: the caller does not have permission to make requests to the specified UP.Link server.
|
CHTTPStatusSvcUnavail
|
503
|
Failure: the request was well-formed and authorized, but the UP.Link server was unable to clear notifications for some reason. The caller should delay for a reasonable period of time, and then retry the request.
|
CHTTPStatusNotFound
|
404
|
Failure: no such notification is pending for the specified subscriber.
|
NtfnDelete, NtfnDeletePrefetch, and NtfnDeleteAlert
Delete a pending alert or prefetch notification.
When you call NtfnDelete, you must specify the notification type. NtfnDeleteAlert and NtfnDeletePrefetch are simply variants of NtfnDelete that presume the notification type.
Visual Basic Synopsis
Dim subs As String
Dim url As String
Dim type As ENtfnType
Dim ntfn As New Ntfn3Client
Dim lngResult As Long
. . .
ntfn.NtfnDelete subs, url, type
'Or...
ntfn.NtfnDeleteAlert subs, url
'Or...
ntfn.NtfnDeletePrefetch subs, url
lngResult = ntfn.NtfnGetLastResult
Visual C++ Synopsis
#include "notify.h"
. . .
OLECHAR *subs;
OLECHAR *url;
ENtfnType type;
HRESULT result;
INtfn3Client *ntfn;
. . .
result = ntfn->NtfnDelete(subs, url, type);
/* Or ... */
result = ntfn->NtfnDeleteAlert(subs, url);
/* Or ... */
result = ntfn->NtfnDeletePrefetch(subs, url);
Perl Synopsis
use Ole;
. . .
$ntfn = CreateObject OLE 'Ntfn3Client.Ntfn3Client.1';
. . .
$ntfn->NtfnDelete($subs, $url, $type);
# Or...
$ntfn->NtfnDeleteAlert($subs, $url);
# Or...
$ntfn->NtfnDeletePrefetch($subs, $url);
$result = $ntfn->NtfnGetLastResult();
Arguments
subs
|
A null-terminated string containing the ID of the subscriber to whom the notification is addressed. For example:
1234567-123_uplink.foo.com
|
url
|
A null-terminated string containing the notification URL; the URL must use the HTTP or HTTPS scheme.
|
type
|
The notification type:
CNtfnTypePrefetch: a prefetch notification (actual value of 1)
CNtfnTypeAlert: an alert (actual value of 2)
For a list of all notification types, see Notification content types (ENtfnType).
|
Returns
If you use C++ to call NtfnDelete, it returns -1 or one of the constants listed in the table below to indicate the HTTP status of the request.
To determine whether a NtfnDelete call has succeeded with Perl or Basic, call NtfnGetLastResult. NtfnGetLastResult returns -1 or one of the HTTP status codes listed below.
IMPORTANT
If a notification call returns a -1 error value, this indicates a general I/O failure has occured. The most common cause of this error is that a corporate firewall is blocking the destination notification port..
|
Constant
|
Value
|
Description
|
CHTTPStatusNoContent
|
204
|
Success: the notification was deleted.
|
CHTTPStatusBadRequest
|
400
|
Failure: the request was malformed in some way.
The most common cause is an invalid subscriber ID. This code is also returned if the URL is empty or malformed.
|
CHTTPStatusForbidden
|
403
|
Failure: the caller does not have permission to make requests to the specified UP.Link server.
|
CHTTPStatusSvcUnavail
|
503
|
Failure: the request was well-formed and authorized, but the UP.Link server was unable to delete the notification for some reason. The caller should delay for a reasonable period of time, and then retry the request.
|
CHTTPStatusNotFound
|
404
|
Failure: no such notification is pending for the specified subscriber.
|
NtfnGetAlertStatus, NtfnGetPrefetchStatus, and NtfnGetStatus
Get the status for a specified alert or prefetch notification.
When you call NtfnGetStatus, you must specify the notification type. NtfnGetAlertStatus and NtfnGetPrefetchStatus are simply variants of NtfnGetStatus that presume the notification type.
Visual Basic Synopsis
Dim subs As String
Dim url As String
Dim type As ENtfnType
Dim status As Long
Dim ntfn As New Ntfn3Client
. . .
status = ntfn.NtfnGetStatus(subs, url, type)
'Or...
status = ntfn.NtfnGetAlertStatus(subs, url)
'Or...
status = ntfn.NtfnGetPrefetchStatus(subs, url)
Visual C++ Synopsis
#include "notify.h"
. . .
OLECHAR *subs;
OLECHAR *url;
ENtfnType type;
HRESULT status;
INtfn3Client *ntfn;
. . .
ntfn->NtfnGetStatus(subs, url, type, &status);
/* Or ... */
ntfn->NtfnGetAlertStatus(subs, url, &status);
/* Or ... */
ntfn->NtfnGetPrefetchStatus(subs, url, &status);
Perl Synopsis
use Ole;
. . .
$ntfn = CreateObject OLE 'Ntfn3Client.Ntfn3Client.1';
. . .
$status = $ntfn->NtfnGetStatus($subs, $url, $type);
# Or...
$status = $ntfn->NtfnGetAlertStatus($subs, $url);
# Or...
$status = $ntfn->NtfnGetPrefetchStatus($subs, $url);
Arguments
subs
|
A null-terminated string containing the ID of the subscriber to whom the notification is addressed. For example:
1234567-123_uplink.foo.com
|
url
|
A null-terminated string containing the notification URL; the URL must use the HTTP or HTTPS scheme.
|
type
|
The notification type:
CNtfnTypePrefetch: a prefetch notification (actual value of 1)
CNtfnTypeAlert: an alert (actual value of 2)
|
Return
A status code indicating the status of the notification. See Notification status codes (ENtfnStatus) for a list of these codes.
NtfnGetCharset
Gets the character set used in the notification client.
Visual Basic Synopsis
Dim charSet As String
Dim ntfn As New Ntfn3Client
. . .
charSet = ntfn.NtfnGetCharset()
Visual C++ Synopsis
#include "notify.h"
. . .
OLECHAR *charSet;
INtfn3Client *ntfn;
. . .
charSet = ntfn->NtfnGetCharset();
Perl Synopsis
use Ole;
. . .
$ntfn = CreateObject OLE 'Ntfn3Client.Ntfn3Client.1';
. . .
$charSet = $ntfn->NtfnGetCharset();
Arguments
None.
Returns
A string specifying the name of the character set used by the notification client for alerts. For a list of character set names, see NtfnSetCharset.
NtfnGetErrorDetail
Returns a string providing a detailed description of the error resulting from the most recent attempt to communicate with the UP.Link server through the current notification object. This includes HTTP, network I/O, and (if appropriate) SSL-level errors.
IMPORTANT
NtfnGetErrorDetail returns error details only for the notification object that was originally used to send a notification. You must use the same object to send a notification and to get error details for the notification.
Visual Basic Synopsis
Dim strError As String
Dim ntfn As New Ntfn3Client
. . .
strError = ntfn.NtfnGetErrorDetail()
Visual C++ Synopsis
#include "notify.h"
. . .
OLECHAR *strError;
INtfn3Client *ntfn;
. . .
ntfn->NtfnGetErrorDetail(&strError);
Perl Synopsis
use Ole;
. . .
$ntfn = CreateObject OLE 'Ntfn3Client.Ntfn3Client.1';
. . .
$strError = $ntfn->NtfnGetErrorDetail();
Arguments
None
Returns
A string providing detailed error information; or an empty string if no description is available.
NtfnGetLastResult
Gets the result of the last notification call to the UP.Link server.
IMPORTANT
NtfnGetLastResult returns results only for the notification object that was originally used to send a notification. You must use the same object to send a notification and to get results for the notification.
If a notification call has not succeeded, you can get additional information on why it failed by calling NtfnGetErrorDetail (see NtfnGetErrorDetail).
Visual Basic Synopsis
Dim lngResult As Long
Dim ntfn As New Ntfn3Client
. . .
lngResult = ntfn.NtfnGetLastResult()
Visual C++ Synopsis
#include "notify.h"
. . .
HRESULT lngResult;
INtfn3Client *ntfn;
. . .
lngResult = ntfn->NtfnGetLastResult();
Perl Synopsis
use Ole;
. . .
$ntfn = CreateObject OLE 'Ntfn3Client.Ntfn3Client.1';
. . .
$lngResult = $ntfn->NtfnGetLastResult();
Arguments
None.
Returns
One of the HTTP status constants listed below or -1 if an I/O error occurred while connecting with the UP.Link server.
IMPORTANT
If a notification call results in a -1 error value, this indicates a general I/O failure has occured. The most common cause of this error is that a corporate firewall is blocking the destination notification port
.
|
Constant
|
Value
|
Description
|
CHTTPStatusNoContent
|
204
|
Success: the notification was added or deleted.
|
CHTTPStatusBadRequest
|
400
|
Failure: the request was malformed in some way.
The most common cause is an invalid subscriber ID. This code is also returned if the URL is empty or malformed.
|
CHTTPStatusForbidden
|
403
|
Failure: the caller does not have permission to make requests to the specified UP.Link server.
|
CHTTPStatusSvcUnavail
|
503
|
Failure: the request was well-formed and authorized, but the UP.Link server was unable to delete or post the notification for some reason. The caller should delay for a reasonable period of time, and then retry the request.
|
CHTTPStatusNotFound
|
404
|
Failure: no such notification is pending for the specified subscriber.
|
NtfnGetProtocolType
Gets the type of protocol (upnotifyps or upnotifyp) used by this object to communicate with the UP.Link server
Visual Basic Synopsis
Dim protocolType As ENtfnProtocol
Dim ntfn As New Ntfn3Client
. . .
protocolType = ntfn.NtfnGetProtocolType()
Visual C++ Synopsis
#include "notify.h"
. . .
ENtfnType protocolType;
INtfn3Client *ntfn;
. . .
protocolType = ntfn->NtfnGetProtocolType();
Perl Synopsis
use Ole;
. . .
$ntfn = CreateObject OLE 'Ntfn3Client.Ntfn3Client.1';
. . .
$protocolType = $ntfn->NtfnGetProtocolType();
Arguments
None.
Returns
One of the following values, indicating the type of notification protocol in use for this object:
CNtfnProtoUpnotifyps
|
2
|
upnotifyps secure (HTTPS-based) protocol
|
CNtfnProtoUpnotifyp
|
1
|
upnotifyp non-secure (HTTP-based) protocol
|
CNtfnProtoNone
|
0
|
The protocol is unknown.
|
NtfnSetCharset
Sets the character set used in the title of an alert.
Visual Basic Synopsis
Dim charSet As String
Dim ntfn As New Ntfn3Client
. . .
ntfn.NtfnSetCharset charSet
Visual C++ Synopsis
#include "notify.h"
. . .
OLECHAR *charSet;
INtfn3Client *ntfn;
. . .
ntfn->NtfnSetCharset(charSet);
Perl Synopsis
use Ole;
. . .
$ntfn = CreateObject OLE 'Ntfn3Client.Ntfn3Client.1';
. . .
$ntfn->NtfnSetCharset($charSet);
Arguments
charset
|
A null-terminated string specifying the character set used by the alert title.
|
The following are common character set names.
|
Character set name
|
US-ASCII
|
ISO-8859-1
|
ISO-8859-2
|
ISO-8859-3
|
ISO-8859-4
|
ISO-8859-5
|
ISO-8859-6
|
ISO-8859-7
|
ISO-8859-8
|
ISO-8859-9
|
latin6
|
SHIFT_JIS
|
EUC-JP
|
KS_C_5601-1987
|
UTF-8
|
GB2312
|
Big5
|
IBM037
|
IBM273
|
IBM280
|
IBM285
|
IBM297
|
windows-1250
|
windows-1251
|
windows-1252
|
windows-1253
|
windows-1254
|
windows-1255
|
windows-1255
|
windows-1256
|
windows-1257
|
Returns
Void.
NtfnGetTimeout
Retrieves the timeout period (in seconds) for notification requests issued to the UP.Link server. You can set this period with NtfnSetTimeout(). For more information, see NtfnSetTimeout.
Visual Basic Synopsis
Dim lngTimeout As Long
Dim ntfn As New Ntfn3Client
. . .
lngTimeout = ntfn.NtfnGetTimeout()
Visual C++ Synopsis
#include "notify.h"
. . .
HRESULT lngTimeout;
INtfn3Client *ntfn;
. . .
lngTimeout = ntfn->NtfnGetTimeout();
Perl Synopsis
use Ole;
. . .
$ntfn = CreateObject OLE 'Ntfn3Client.Ntfn3Client.1';
. . .
$lngTimeout = $ntfn->NtfnGetTimeout();
Arguments
None.
Returns
The timeout period (in seconds) for HTTP requests issued to the UP.Link server. If the return value is 0, the timeout period is infinite.
NtfnPostAlert
Posts a push notification containing an alert to the UP.Link server.
IMPORTANT
You must set the UP.Link server host before calling NtfnPostAlert. If you are posting a secure alert, you must also call NtfnLoadCertAndKey and NtfnRequireSecureConnection before calling NtfnPostAlert.
Visual Basic Synopsis
Dim subs As String
Dim url As String
Dim ttlSeconds As Long
Dim alertType As String
Dim alertTitle As String
Dim len As Long
Dim lngResult As Long
Dim ntfn As New Ntfn3Client
. . .
ntfn.NtfnPostAlert subs, url, ttlSeconds,
alertType, alertTitle, len
lngResult = ntfn.NtfnGetLastResult
Visual C++ Synopsis
#include "notify.h"
. . .
OLECHAR *subs;
OLECHAR *url;
long ttlSeconds;
OLECHAR *alertType;
OLECHAR *alertTitle;
int len;
HRESULT result;
INtfn3Client *ntfn;
. . .
result = ntfn->NtfnPostAlert (subs, url, ttlSeconds,
alertType, alertTitle, len);
Perl Synopsis
use Ole;
. . .
$ntfn = CreateObject OLE 'Ntfn3Client.Ntfn3Client.1';
. . .
$ntfn->NtfnSetHost($server);
$ntfn->NtfnPostAlert($subs, $url, $ttlSeconds, $alertType,
$alertTitle, $len);
$result = $ntfn->NtfnGetLastResult();
Arguments
subs
|
A null-terminated string containing the ID of the subscriber to whom the notification is addressed. For example:
1234567-123_uplink.foo.com
|
url
|
A null-terminated string containing the notification URL; the URL must use the HTTP or HTTPS scheme.
|
ttlSeconds
|
The notification's Time To Live (TTL) in seconds. If the UP.Link server cannot deliver the notification within this period of time, it expires the notification.
To specify the maximum TTL allowed by the UP.Link server, specify 0. By default, the maximum TTL is 60 days; however, this period is configurable by the UP.Link server operator.
|
alertType
|
A null-terminated string specifying the type of signal to issue to the subscriber. It consists of four characters, representing the device-dependent signal, sound, visual signal, and vibration signal, respectively. You can specify several values for each type of signal:
Device-dependent signal: -, D
Sound: -, 1, 2, 3, 4
Visual signal: -, 1, 2, 3, 4
Vibration: -, 1
The dash (-) turns the signal off; D is the default signal; the numbers specify progressively higher levels of urgency. For example, -23- specifies sound 2 and visual signal 3.
The recommended alert_type string is:
'D---'
|
alertTitle
|
A string containing the title of the alert to display in the phone's alert card. If the string is not NULL-terminated, you must specify the len argument, to specify its length.
|
len
|
For an alert, the length of the alert title string in bytes. This is required only for character sets, such as SHIFT-JIS, which might include NULL characters.
|
Returns
If you use C++ to call NtfnPostAlert, it returns -1 or one of the HTTP constants listed in the table below to indicate the status of the request.
To determine whether a NtfnPostAlert call has succeeded with Perl or Basic, call NtfnGetLastResult. NtfnGetLastResult will return one of the HTTP status codes listed below.
IMPORTANT
If a notification call returns a -1 error value, this indicates a general I/O failure has occured. The most common cause of this error is that a corporate firewall is blocking the destination notification port.
|
Constant
|
Value
|
Description
|
CHTTPStatusNoContent
|
204
|
Success: the notification was accepted for delivery by the UP.Link server. The CHTTPStatusNoContent constant is used because the UP.Link server's response does not contain any content.
|
CHTTPStatusBadRequest
|
400
|
Failure: the request was malformed in some way.
The most common cause is an invalid subscriber ID. This code is also returned if the URL is empty or malformed or if the alert type or title string is empty or malformed. The caller should not repeat the request without changing it to address the cause of failure.
|
CHTTPStatusForbidden
|
403
|
Failure: the caller does not have permission to make requests to the specified UP.Link server.
|
CHTTPStatusSvcUnavail
|
503
|
Failure: the request was well-formed and authorized, but the UP.Link server was unable to accept the notification for delivery for some reason. The caller should delay for a reasonable period of time, and then retry the request.
|
IMPORTANT
The CHTTPStatusNoContent constant (204) indicates that a notification has been accepted for delivery; it means the UP.Link server's response to the notification form your application was received successfully.
NtfnPostAlertAndInvalURL
Convenience method that posts a push notification containing both an alert and a cache operation to the UP.Link server. The cache operation removes the alert URL from the device's cache, ensuring that when the user requests the URL, the device will request it from the UP.Link server instead of retrieving it from the cache.
IMPORTANT
You must set the UP.Link server host before calling NtfnPostAlertAndInvalURL. If you are sending a secure alert, you must also call NtfnLoadCertAndKey and NtfnRequireSecureConnection before calling NtfnPostAlertAndInvalURL.
Visual Basic Synopsis
Dim subs As String
Dim url As String
Dim ttlSeconds As Long
Dim alertType As String
Dim alertTitle As String
Dim len As Long
Dim lngResult As Long
Dim ntfn As New Ntfn3Client
. . .
ntfn.NtfnPostAlertAndInvalURL subs, url, ttlSeconds,
alertType, alertTitle, len
lngResult = ntfn.NtfnGetLastResult
Visual C++ Synopsis
#include "notify.h"
. . .
OLECHAR *subs;
OLECHAR *url;
long ttlSeconds;
OLECHAR *alertType;
OLECHAR *alertTitle;
int len;
HRESULT result;
INtfn3Client *ntfn;
. . .
result = ntfn->NtfnPostAlertAndInvalURL(subs, url, ttlSeconds,
alertType, alertTitle, len);
Perl Synopsis
use Ole;
. . .
$ntfn = CreateObject OLE 'Ntfn3Client.Ntfn3Client.1';
. . .
$ntfn->NtfnSetHost($server);
$ntfn->NtfnPostAlertAndInvalURL($subs, $url, $ttlSeconds,
$alertType, $alertTitle, $len);
$result = $ntfn->NtfnGetLastResult();
Arguments
subs
|
A null-terminated string containing the ID of the subscriber to whom the notification is addressed. For example:
1234567-123_uplink.foo.com
|
url
|
A null-terminated string containing the notification URL; the URL must use the HTTP or HTTPS scheme.
|
ttlSeconds
|
The notification's Time To Live (TTL) in seconds. If the UP.Link server cannot deliver the notification within this period of time, it expires the notification.
To specify the maximum TTL allowed by the UP.Link server, specify 0. By default, the maximum TTL is 60 days; however, this period is configurable by the UP.Link server operator.
|
alertType
|
A null-terminated string specifying the type of signal to issue to the subscriber. It consists of four characters, representing the device-dependent signal, sound, visual signal, and vibration signal, respectively. You can specify several values for each type of signal:
Device-dependent signal: -, D
Sound: -, 1, 2, 3, 4
Visual signal: -, 1, 2, 3, 4
Vibration: -, 1
The dash (-) turns the signal off; D is the default signal; the numbers specify progressively higher levels of urgency. For example, -23- specifies sound 2 and visual signal 3.
The recommended alert_type string is:
'D---'
|
alertTitle
|
A string containing the title of the alert to display in the phone's alert card. If the string is not NULL-terminated, you must specify the len argument, to specify its length.
|
len
|
For an alert, the length of the alert title string in bytes. This is required only for character sets, such as SHIFT-JIS, which might include NULL characters.
|
Returns
If you use C++ to call NtfnPostAlertAndInvalURL, it returns -1 or one of the HTTP constants listed in the table below to indicate the status of the request.
To determine whether a NtfnPostAlertAndInvalURL call has succeeded with Perl or Basic, call NtfnGetLastResult. NtfnGetLastResult returns -1 or one of the HTTP status codes listed below.
IMPORTANT
If a notification call returns a -1 error value, this indicates a general I/O failure has occured. The most common cause of this error is that a corporate firewall is blocking the destination notification port.
|
Constant
|
Value
|
Description
|
CHTTPStatusNoContent
|
204
|
Success: the notification was accepted for delivery by the UP.Link server. The CHTTPStatusNoContent constant is used because the UP.Link server's response does not contain any content.
|
CHTTPStatusBadRequest
|
400
|
Failure: the request was malformed in some way.
The most common cause is an invalid subscriber ID. This code is also returned if the URL is empty or malformed or if the alert type or title string is empty or malformed. The caller should not repeat the request without changing it to address the cause of failure.
|
CHTTPStatusForbidden
|
403
|
Failure: the caller does not have permission to make requests to the specified UP.Link server.
|
CHTTPStatusSvcUnavail
|
503
|
Failure: the request was well-formed and authorized, but the UP.Link server was unable to accept the notification for delivery for some reason. The caller should delay for a reasonable period of time, and then retry the request.
|
IMPORTANT
The CHTTPStatusNoContent constant (204) indicates that a notification has been accepted for delivery; it means the UP.Link server's response to the notification form your application was received successfully.
NtfnPostCacheOp
Uses the push channel to deliver a cache operation that removes a specified URL from the cache of a user's phone.
IMPORTANT
You must set the UP.Link server host before calling NtfnPostCacheOp. If you are sending a secure alert, you must also call NtfnLoadCertAndKey and NtfnRequireSecureConnection before calling NtfnPostCacheOp.
Visual Basic Synopsis
Dim subs As String
Dim url As String
Dim ttlSeconds As Long
Dim cacheOpCode As String
Dim lngResult As Long
Dim ntfn As New Ntfn3Client
. . .
ntfn.NtfnPostCacheOp subs, url, ttlSeconds, cacheOpCode
lngResult = ntfn.NtfnGetLastResult
Visual C++ Synopsis
#include "notify.h"
. . .
OLECHAR *subs;
OLECHAR *url;
long ttlSeconds;
OLECHAR *cacheOpCode;
HRESULT result;
INtfn3Client *ntfn;
. . .
result = ntfn->NtfnPostCacheOp (subs, url, ttlSeconds,
cacheOpCode);
Perl Synopsis
use Ole;
. . .
$ntfn = CreateObject OLE 'Ntfn3Client.Ntfn3Client.1';
. . .
$ntfn->NtfnSetHost($server);
$ntfn->NtfnPostCacheOp($subs, $url, $ttlSeconds,
$cacheOpCode);
$result = $ntfn->NtfnGetLastResult();
Arguments
subs
|
A null-terminated string containing the ID of the subscriber to whom the cache operation is addressed. For example:
1234567-123_uplink.foo.com
|
url
|
A null-terminated string containing the URL(s) to be removed from the phone's cache.
The URL must use the HTTP or HTTPS scheme.
|
ttlSeconds
|
The notification's Time To Live (TTL) in seconds. If the UP.Link server cannot deliver the cache operation within this period of time, it expires it.
To specify the maximum TTL allowed by the UP.Link server (typically 60-days), specify 0.
|
cacheOpCode
|
Specifies which cache entries to invalidate. Specify one of the following strings:
InvalSvc: invalidate all cache entries for the current service
InvalURL: invalidate only the cache entries with the specified URL
|
Returns
If you use C++ to call NtfnPostCacheOp, it returns -1 or one of the HTTP constants listed in the table below to indicate the status of the request.
To determine whether a NtfnPostCacheOp call has succeeded with Perl or Basic, call NtfnGetLastResult. NtfnGetLastResult will return one of the HTTP status codes listed below.
IMPORTANT
If a notification call returns a -1 error value, this indicates a general I/O failure has occured. The most common cause of this error is that a corporate firewall is blocking the destination notification port.
|
Constant
|
Value
|
Description
|
CHTTPStatusNoContent
|
204
|
Success: the cache operation was accepted for delivery by the UP.Link server. The CHTTPStatusNoContent constant is used because the UP.Link server's response does not contain any content.
|
CHTTPStatusBadRequest
|
400
|
Failure: the request was malformed in some way.
The most common cause is an invalid subscriber ID. This code is also returned if the URL is empty or malformed. The caller should not repeat the request without changing it to address the cause of failure.
|
CHTTPStatusForbidden
|
403
|
Failure: the caller does not have permission to make requests to the specified UP.Link server.
|
CHTTPStatusSvcUnavail
|
503
|
Failure: the request was well-formed and authorized, but the UP.Link server was unable to accept the notification for delivery for some reason. The caller should delay for a reasonable period of time, and then retry the request.
|
IMPORTANT
The CHTTPStatusNoContent constant (204) indicates that a cache operation has been accepted for delivery; it means the UP.Link server's response to the POST by your application was received successfully.
NtfnPostPrefetch
The NtfnPostPrefetch method posts a prefetch notification.
IMPORTANT
You must set the UP.Link server host before calling NtfnPostPrefetch. If you are sending a secure alert, you must also call NtfnLoadCertAndKey and NtfnRequireSecureConnection before calling NtfnPostPrefetch.
Visual Basic Synopsis
Dim subs As String
Dim url As String
Dim ttlSeconds As Long
Dim lngResult As Long
Dim ntfn As New Ntfn3Client
. . .
ntfn.NtfnPostPrefetch subs, url, ttlSeconds
lngResult = ntfn.NtfnGetLastResult
Visual C++ Synopsis
#include "notify.h"
. . .
OLECHAR *subs;
OLECHAR *url;
long ttlSeconds;
HRESULT result;
INtfn3Client *ntfn;
. . .
result = ntfn->NtfnPostPrefetch (subs, url, ttlSeconds);
Perl Synopsis
use Ole;
. . .
$ntfn = CreateObject OLE 'Ntfn3Client.Ntfn3Client.1';
. . .
$ntfn->NtfnSetHost($server);
$ntfn->NtfnPostPrefetch($subs, $url, $ttlSeconds);
$result = $ntfn->NtfnGetLastResult();
Arguments
subs
|
A null-terminated string containing the ID of the subscriber to whom the notification is addressed. For example:
1234567-123_uplink.foo.com
|
url
|
A null-terminated string containing the notification URL; the URL must use the HTTP or HTTPS scheme.
|
ttlSeconds
|
The notification's Time To Live (TTL) in seconds. If the UP.Link server cannot deliver the notification within this period of time, it expires the notification.
To specify the maximum TTL allowed by the UP.Link server (typically 60-days), specify 0.
|
Returns
If you use C++ to call NtfnPostPrefetch, it returns -1 or one of the HTTP constants listed in the table below to indicate the status of the request.
To determine whether a NtfnPostPrefetch call has succeeded with Perl or Basic, call NtfnGetLastResult. NtfnGetLastResult will return one of the HTTP status codes listed below.
IMPORTANT
If a notification call returns a -1 error value, this indicates a general I/O failure has occured. The most common cause of this error is that a corporate firewall is blocking the destination notification port.
|
Constant
|
Value
|
Description
|
CHTTPStatusNoContent
|
204
|
Success: the notification was accepted for delivery by the UP.Link server. The CHTTPStatusNoContent constant is used because the UP.Link server's response does not contain any content.
|
CHTTPStatusBadRequest
|
400
|
Failure: the request was malformed in some way.
The most common cause is an invalid subscriber ID. This code is also returned if the URL is empty or malformed or if the alert type or title string is empty or malformed. The caller should not repeat the request without changing it to address the cause of failure.
|
CHTTPStatusForbidden
|
403
|
Failure: the caller does not have permission to make requests to the specified UP.Link server.
|
CHTTPStatusSvcUnavail
|
503
|
Failure: the request was well-formed and authorized, but the UP.Link server was unable to accept the notification for delivery for some reason. The caller should delay for a reasonable period of time, and then retry the request.
|
IMPORTANT
The CHTTPStatusNoContent constant (204) indicates that a notification has been accepted for delivery; it means the UP.Link server's response to the POST by your application was received successfully.
NtfnPush
Posts a notification to the UP.Link server, using the push channel.
Currently, the only content types you should include in push notifications are:
- Alerts
- Cache operations
- Digests containing one or more alerts and/or cache operations
IMPORTANT
You must set the UP.Link server host before calling NtfnPush. If you are sending a secure notification, you must also call NtfnLoadCertAndKey and NtfnRequireSecureConnection before calling NtfnPush.
Visual Basic Synopsis
Dim subs As String
Dim url As String
Dim nid As String
Dim ttlSeconds As Long
Dim contentType As String
Dim entity As String
Dim lngResult As Long
Dim ntfn As New Ntfn3Client
. . .
ntfn.NtfnPush subs, url, nid, ttlSeconds, contentType, entity
lngResult = ntfn.NtfnGetLastResult
Visual C++ Synopsis
#include "notify.h"
. . .
OLECHAR *subs;
OLECHAR *url;
OLECHAR *nid;
long ttlSeconds;
OLECHAR *contentType;
OLECHAR *entity;
HRESULT result;
INtfn3Client *ntfn;
. . .
result = ntfn->NtfnPush (subs, nid, ttlSeconds,
contentType, entity);
Perl Synopsis
use Ole;
. . .
$ntfn = CreateObject OLE 'Ntfn3Client.Ntfn3Client.1';
. . .
$ntfn->NtfnSetHost($server);
$ntfn->NtfnPush($subs, $url, $nid, $ttlSeconds, $contentType,
$entity);
$result = $ntfn->NtfnGetLastResult();
Arguments
subs
|
A null-terminated string containing the ID of the subscriber to whom the push is addressed. For example:
1234567-123_uplink.foo.com
|
url
|
A null-terminated string containing the notification URL; the URL must use the HTTP or HTTPS scheme.
|
nid
|
An optional, null-terminated ASCII string identifying the notification for the purposes of coalescing, status query, and deletion. The string must be shorter than 512 bytes.
If you specify this option, it is recommended that you prefix it with domain name of your application. For example:
uplanet.com/myapp-deck-999
|
ttlSeconds
|
The notification's Time To Live (TTL) in seconds. If the UP.Link server cannot deliver the notification within this period of time, it expires the notification.
To specify the maximum TTL allowed by the UP.Link server, specify 0. By default, the maximum TTL is 60 days; however, this period is configurable by the UP.Link server operator.
|
contentType
|
A null-terminated string specifying the type of content to be sent in the notification. The following strings are currently supported:
application/x-up-alert: an alert
application/x-up-cacheop: a cache operation
multipart/mixed: a digest containing alerts, cache operations, or both.
|
entity
|
The alert, cache operation, or digest to push to the subscriber. For information on constructing these entities, see Chapter 3 of the UP.SDK Developer's Guide.
|
Returns
If you use C++ to call NtfnPush, it returns -1 or one of the HTTP constants listed in the table below to indicate the status of the request.
To determine whether a NtfnPush call has succeeded with Perl or Basic, call NtfnGetLastResult. NtfnGetLastResult will return one of the HTTP status codes listed below.
IMPORTANT
If a notification call returns a -1 error value, this indicates a general I/O failure has occured. The most common cause of this error is that a corporate firewall is blocking the destination notification port.
|
Constant
|
Value
|
Description
|
CHTTPStatusNoContent
|
204
|
Success: the notification was accepted for delivery by the UP.Link server. The CHTTPStatusNoContent constant is used because the UP.Link server's response does not contain any content.
|
CHTTPStatusBadRequest
|
400
|
Failure: the request was malformed in some way.
The most common cause is an invalid subscriber ID. This code is also returned if the URL is empty or malformed or if the alert type or title string is empty or malformed. The caller should not repeat the request without changing it to address the cause of failure.
|
CHTTPStatusForbidden
|
403
|
Failure: the caller does not have permission to make requests to the specified UP.Link server.
|
CHTTPStatusSvcUnavail
|
503
|
Failure: the request was well-formed and authorized, but the UP.Link server was unable to accept the notification for delivery for some reason. The caller should delay for a reasonable period of time, and then retry the request.
|
The CHTTPStatusNoContent constant (204) indicates that a notification has been accepted for delivery; it means the UP.Link server's response to the notification form your application was received successfully.
NtfnRemoveAlertFromInbox
Removes a specified alert from a specified subscriber's inbox. NtfnRemoveAlertFromInbox works only with alerts that the UP.Link server has successfully delivered to a subscriber's device. To remove alerts for which delivery is still pending, use NtfnDelete or NtfnDeleteAlert instead. For more information, see NtfnDelete, NtfnDeletePrefetch, and NtfnDeleteAlert.
Visual Basic Synopsis
Dim subs As String
Dim url As String
Dim ttlSeconds As Long
Dim alertType As String
Dim ntfn As New Ntfn3Client
. . .
ntfn.NtfnRemoveAlertFromInbox subs, url,
ttlSeconds, alertType
Visual C++ Synopsis
#include "notify.h"
. . .
OLECHAR *subs;
OLECHAR *url;
long ttlSeconds;
OLECHAR *alertType;
INtfn3Client *ntfn;
. . .
ntfn->NtfnRemoveAlertFromInbox(subs, url, ttlSeconds,
alertType);
Perl Synopsis
use Ole;
. . .
$ntfn = CreateObject OLE 'Ntfn3Client.Ntfn3Client.1';
. . .
$ntfn->NtfnRemoveAlertFromInbox($subs, $url, $ttlSeconds,
$alertType);
Arguments
To remove an alert from a subscriber's inbox, you set the arguments below to the values that you specified in the NtfnPostAlert call that originally sent the alert.
subs
|
A null-terminated string containing the ID of the subscriber to whom the alert is addressed. For example:
1234567-123_uplink.foo.com
|
url
|
A null-terminated string containing the notification URL.
|
ttlSeconds
|
The notification's Time To Live (TTL) in seconds.
|
alertType
|
A null-terminated string specifying the type of signal to issue to the subscriber.
|
NtfnSetHost
The NtfnSetHost method specifies the UP.Link server host to send notifications to.
You must call this method before you send an alert or prefetch notification.
Visual Basic Synopsis
Dim hostname As String
Dim ntfn As New Ntfn3Client
. . .
ntfn.NtfnSetHost hostname
Visual C++ Synopsis
#include "notify.h"
. . .
OLECHAR *hostname;
HRESULT result;
INtfn3Client *ntfn;
. . .
result = ntfn->NtfnSetHost(hostname);
Perl Synopsis
use Ole;
. . .
$ntfn = CreateObject OLE 'Ntfn3Client.Ntfn3Client.1';
. . .
$ntfn->NtfnSetHost($hostname);
Arguments
hostname
|
The domain of the UP.Link server host to send notifications to.
|
NtfnSetNonSecurePort
Sets the non-secure port to use when communicating with the UP.Link server.
Note that if you do not call this method, the default port will be used.
Visual Basic Synopsis
Dim upnotifypPort As Long
Dim ntfn As New Ntfn3Client
. . .
ntfn.NtfnSetNonSecurePort upnotifypPort
Visual C++ Synopsis
#include "notify.h"
. . .
long upnotifypPort;
HRESULT result;
INtfn3Client *ntfn;
. . .
result = ntfn->NtfnSetNonSecurePort(upnotifypPort);
Perl Synopsis
use Ole;
. . .
$ntfn = CreateObject OLE 'Ntfn3Client.Ntfn3Client.1';
. . .
$ntfn->NtfnSetNonSecurePort($upnotifypPort);
Arguments
upnotifypPort
|
The non-secure port on the UP.Link server to direct communication to, if a communication with the port specified by upnotifypsPort fails. If you specify 0, the default non-secure port is used. Unwired Planet strongly recommends that you use the default non-secure port.
|
NtfnSetTimeout
Sets the timeout period (in seconds) for notification requests issued to the UP.Link server.
By default, Notification library functions that communicate with the UP.Link server block indefinitely, awaiting a reply. Calling NtfnSetTimeout() with a non-zero value to causes notification requests to time out if the server does not reply within the specified number of seconds.
Visual Basic Synopsis
Dim seconds As Long
Dim ntfn As New Ntfn3Client
. . .
ntfn.NtfnSetTimeout seconds
Visual C++ Synopsis
#include "notify.h"
. . .
long seconds;
HRESULT result;
INtfn3Client *ntfn;
. . .
result = ntfn->NtfnSetTimeout(seconds);
Perl Synopsis
use Ole;
. . .
$ntfn = CreateObject OLE 'Ntfn3Client.Ntfn3Client.1';
. . .
$ntfn->NtfnSetTimeout($seconds);
Arguments
seconds
|
The timeout period in seconds. To reset the timeout to the default value (infinite--never time out), specify 0.
|
[Cover] [Previous Section] [Next Section] [Index]
Current chapter: COM Notification Library Reference
Section 29 out of 79 total sections
, Section 4 out of 5 sections in this chapter
Copyright © 1999, Unwired Planet, Inc. All rights
reserved.