![MACROMEDIA BREEZE-USING THE BREEZE XML WEB SERVICES Use Manual Download Page 29](http://html1.mh-extra.com/html/macromedia/breeze-using-the-breeze-xml-web-services/breeze-using-the-breeze-xml-web-services_use-manual_3281905029.webp)
Integrating Breeze with a directory service
29
To synchronize Breeze with the directory service:
1.
Log in by calling the
login
action on the Breeze server, specifying the login name and password
of an account administrator. Examine the returned HTTP headers to find the value of the
BREEZESESSION cookie, which you need when calling subsequent actions.
Note:
Consider creating an administrative user specifically for performing synchronizations. If you
create such a user, you should exclude it from the list of users to synchronize when you perform the
synchronization.
The following code example logs in a user and obtains the cookie value:
<cfset login="[email protected]">
<cfset password="abcdefg">
<cfset accesskey="0123456789101112">
<cfset baseurl="http://breeze.example.com/">
<cfset params="accesskey=#accesskey#&action=login&login=#login#&password=
#password#">
<cfhttp url="#baseurl#api/xml?#params#" method="get">
<cfset loginHeaders= "#cfhttp.ResponseHeader#" />
<cfloop collection="#loginHeaders#" item="httpHeader">
<cfif httpHeader eq "Set-Cookie">
<cfset value= loginHeaders[httpHeader] />
<cfset cookieHeader="#value[1]#" />
<cfloop list="#cookieHeader#" index="c" delimiters=";">
<cfset cookieName= Left(c, Find('=', c)-1) />
<cfif cookieName eq "BREEZESESSION">
<cfset fullCookie= mid(c, len(cook2,
len(c)-len(cook1) />
<cfset loginCookie= Left(fullCookie, Find('.', fullCookie)-1) />
</cfif>
</cfloop>
</cfif>
</cfloop>
2.
Check that the
login
action completed successfully by parsing the returned XML and
examining the value of the
status
tag’s
code
attribute. If the status code isn’t
"ok"
, determine
what the error was and handle it appropriately.
<cfset xml= XmlParse(cfhttp.FileContent)>
<cfset resultsElement= XmlSearch(xml, "//status[@code='ok']")>
<cfif ArrayLen(resultsElement) ne 1>
<!--- No status code "ok" found. Check for other status codes and handle
errors. --->
</cfif>
Summary of Contents for BREEZE-USING THE BREEZE XML WEB SERVICES
Page 1: ...Using the Breeze XML Web Services...
Page 8: ...8 Contents...
Page 12: ...12 Introduction Before You Begin...
Page 26: ...26 Chapter 2 Working with Filters...
Page 36: ...36 Chapter 3 Common Tasks...
Page 112: ...112 Chapter 4 Action Reference...
Page 186: ...186 Chapter 5 XML Results Reference...
Page 196: ...196 Index...