CCAPITestScript
This script goes into the individual subsite's customcf folder and is ran directly.
<!--- Use: To test that the CCAPI configuration is working correctly. Requirements: The CCAPI.xml file also reflects the next cfscript block and the ADF has been reset. To reset the adf: Log in as an administrator. Add ?resetSiteADF=1&resetServerADF=1 to the end of your url ----> <cfscript> userid = "admin-commonspot"; password = "password"; webserviceURL = "http://myserver/commonspot/webservice/cs_service.cfc?wsdl"; site = "http://myserver/sitename"; datadir = ""; // the full path to the location of your source uploaded documents/images (requires trailiing slash) </cfscript>
<!--- The following should not need to be modified. --->
<cfoutput>Time at beginning of CCAPI login process: #now()#
</cfoutput><cfobject webservice="#webserviceURL#" name = "ws">
<cfinvoke webservice = "#ws#" method ="cslogin" site = "#site#" csuserid="#userid#" cspassword="#password#" subsiteid="1" subsiteurl="/" returnVariable="loginResult">
<cfif ListFirst(loginResult, ":") is "Error"> <cfoutput>Login Failed - #loginResult#</cfoutput> <cfexit> </cfif>
<cfset ssid = ListRest(loginResult, ":")>
<cfoutput>Original Method Login -- #ssid#
</cfoutput>
<cfinvoke webservice="#ws#"
method="cslogout"
ssid="#ssid#"
returnVariable="finalLogoutResult">
<CFOUTPUT>Original Method Logout -- #finalLogoutResult#
</CFOUTPUT>
Time at end of CCAPI test: #now()#
</cfoutput>
<cfoutput>
ADF.CCAPI method
<cfset myInitResult = application.adf.ccapi.initccapi()>
I think I initalized the CCAPI.
<cfset myLoginResult = application.adf.ccapi.login(1)>
myLoginResult:
<cfdump var="#myLoginResult#" label="myLoginResult" expand="no"> <cfset AmLoggedIn = application.adf.ccapi.loggedin()>
Did I login to the site?: #AmLoggedIn#
<cfset AmLoggedOut = application.adf.ccapi.logout()>
Did I logout of the site?: #AmLoggedOut#
</cfoutput>