Macromedia breeze-using the breeze xml web services User Manual

Page of 196
30
Chapter 3:  Common Tasks
3.
Request a list of Breeze users from the Breeze server by calling the 
The server returns a complete list of all principals, including principals that aren’t users. 
(For information about principals, see 
.) 
The following code calls the 
principal-list
 action. The cookie value from the previous step 
is included as an HTTP parameter.
<cfhttp url="#baseurl#api/xml?action=principal-list&accesskey=#accesskey#" 
method="post">
<cfhttpparam type="Cookie" name="BREEZESESSION" value="#loginCookie#">
</cfhttp>
Note: This HTTP request uses the 
"post"
 method rather than 
"get"
 because the only way to 
specify an HTTP parameter in CFML is by using 
"post"
. The URL and the query parameters 
remain the same as if you were using 
"get"
, however. 
4.
Ensure that the action completed successfully by parsing the returned XML to ensure that the 
value of the 
status
 tag’s 
code
 attribute is set to 
"ok"
. If your code must be robust, you should 
check the 
status
 tag in the returned XML after every action.
5.
If the status code is 
"ok"
, search the returned list of principals to find all principals that have a 
type
 attribute set to 
user
. The following example places a list of all Breeze users into the array 
allUsers
:
<cfset xmlPrincipalList= XmlParse(cfhttp.FileContent)>
<cfset allUsers = XmlSearch(xmlPrincipalList, "//principal [@type='user']")>
6.
Obtain a list of all the users listed in the directory service. The procedure for obtaining this list 
depends on the directory service.
7.
Compare the values contained in the 
 tags for the Breeze users with the e-mail addresses 
from the directory service, using a list-comparison algorithm of your choice. Determine which 
users are in the directory service but not in Breeze; these are new users to be added to Breeze. 
Also determine which users are in Breeze but not in the directory service; these users should be 
removed from Breeze. Finally, determine which users are in both Breeze and the directory 
service, but have different names in the two places; these users’ names should be changed 
in Breeze.