Hey paul did you ever get this to work. I am stuck in the same position as you 
are. I spent a few days dissecting Viele/Retriever and this is what I ended up 
with. Obviously it doesnt work else I would be posting a working example. If 
you did get yours to work, can you post some code and show me where I went 
wrong.


Code Snippet:

       <cfhttp resolveurl="yes" url="http://rets.armls.mlsrets.com";  
method="get">
       </cfhttp>


<cfdump var="#cfhttp.responseHeader#" />
<cfdump 
var="#ArrayLen(ListToArray(Trim(cfhttp.responseHeader["WWW-Authenticate"])))#" 
/>
<cfscript>
username = '';
password = '';
       function create_Auth(){
               tempList = 
Replace(cfhttp.responseHeader["WWW-Authenticate"],"Digest ",'','All');
               headerArr = ListToArray(Trim(tempList));
               auth_Temp = 
ListToArray(Trim(cfhttp.responseHeader["WWW-Authenticate"]),' ');
               auth_Type = auth_Temp[1];

               // create basic auth header
               if (auth_Type eq 'Basic'){
                       auth = username & ':' & password;
                       encodedAuth = 'Authorization: Basic ' & toBase64(auth);
                       return encodedAuth;
               }
               // create digest auth header
               if(auth_Type eq 'Digest'){
                       authStc = structNew();
                       for(i=1;i lte ArrayLen(headerArr);i=i+1){
                               key = 
Replace(Left(headerArr[i],Find('=',headerArr[i])),'=','','ALL');
                               value = 
Replace(RemoveChars(headerArr[i],1,Find('=',headerArr[i],"1")),'"','','ALL');
                               authStc[key] = value;
                       }
                       auth_Realm = authStc['realm'];

                       respA1 = username & ':' & auth_Realm & ':' & password;
                       respA2 = 'POST:' & ':' & '/rets/login';

                       auth_Nonce = authStc['nonce'];
                       auth_Opaque = authStc['opaque'];

                       is2069 = false;
                       if(structKeyExists(authStc,'qop') and NOT 
structKeyExists(authStc,'auth_qop')){
                               is2069 = true;
                       }

                       if(is2069){
                               raw_Digest = Lcase(Hash(respA1,"MD5")) & ':' & 
auth_Nonce & ':' & Lcase(Hash(respA2,"MD5"));
                               encodedAuth = 'Authorization: Digest username=' 
& chr(34) & username & chr(34) & ',' &
                                                         'realm=' & chr(34) & 
auth_Realm & chr(34) & ',' &
                                                         'nonce=' & auth_Nonce 
& ',' &
                                                         'uri=' & chr(34) & 
'/rets/login' & chr(34) & ',' &
                                                         'response=' & 
Lcase(Hash(raw_Digest,"MD5")) & ',' &
                                                         'opaque=' & chr(34) & 
auth_Opaque & chr(34);
                       }else{
                               thisVar = "NO";
                       }




                       return encodedAuth;
               }


       }
</cfscript>

<cfdump var="#create_Auth()#">


               <cfhttp url="http://rets.armls.mlsrets.com"; method="post">
                       <cfhttpparam name="Authorization" type="header" 
value="#create_Auth()#">
               </cfhttp>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion MX7 and Flex 2 
Build sales & marketing dashboard RIA’s for your business. Upgrade now
http://www.adobe.com/products/coldfusion/flex2?sdid=RVJT

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:278677
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to