Authenticate ColdFusion Sample

ColdFusion makes it very easy to integrate with web services. When consuming netFORUM xWeb services the first thing you will need to do is authorize your access with the Authenticate web method. After initial authorization is successful, a token is passed back in the SOAP header. The ColdFusion code below can be used to make the initial authorization call and will set the valid token to a variable (nfws_token) that will be used with the next request made.

Sample Code

<!--- 
//////////////////////////////////////////////////////////////
// //
// author = Derek T. Versteegen //
// organization = American Academy of Pediatrics //
// date added = 10/18/2007 //
// date last modified = 10/18/2007 - DTV //
// //
// notes = code examples of consuming netFORUM baseline //
// xweb methods by way of ColdFusion Components //
// //
// dependancies = netforum_xweb.cfc //
// //
//////////////////////////////////////////////////////////////
--->
 
<!--- xWeb:Authenticate --->
<cfinvoke component="/xxxxxx/netforum_xweb" method="xweb_Authenticate" returnvariable="nfws_token">
<cfinvokeargument name="uname" value="xxxxxx" omit="no">
<cfinvokeargument name="pword" value="xxxxxx" omit="no">
</cfinvoke>
<cfdump var="#session.nfws_token#" label="nfws_token">

The result of this code (session.nfws_token) is either a valid GUID or an all zero GUID based on a successful or unsuccessful request/authorization - respectively.

Other xWeb ColdFusion examples throughout the wiki will assume this process has taken place.

See Also