PutContext

Sets the value for the given name in the "context" properties. If there is an existing value present for the entity identified by the name, it is replaced. Context properties include the following constants: account ID, account password, service name, service key, and request ID.

Syntax

ASCII Version
int putContext(Message* message,const char* name,
const char* value) 
Unicode Version
int putContext(Message* message,const UChar* name,
const UChar* value) 

Parameters

  • Message—message to which this function applies
  • Name—name with which the specified value is to be associated
  • Value—value to be associated with the specified name

Results

Returns 0 (if successful) or error code.

Example

ASCII Version
int nRet;
Message* message = createMessage();
nRet = putContext( message, "account.id", "user1") ; 
Unicode Version
int nRet; 
Message* message; 
// construct 16-bit string 
UChar accountID[32]; 
char* account="account.id";
UChar accountIDValue[32]; 
char* accountValue="user1"; 
u_charsToUChars(account,	accountID,	strlen(account)); 
accountID [ strlen(account)]=0; 
u_charsToUChars(accountValue,	accountIDValue,	strlen(accountValue)); 
accountIDValue [ strlen(accountValue)]=0;	
message = createMessage(); 
nRet = putContext( message,	accountID, accountIDValue);