Hi

I am using this tutorial :

http://www.dantor.com/support/cfdocs/Developing_ColdFusion_MX_Applicatio
ns_with_CFML/webservices5.html

to set up some web services on my server. I am trying to secure the web
service by using an applicaton.cfm page as described towards the end. I
have attached my applciation code. I always get an error 

Could not perform web service invocation "getInvoices" because AxisFault
faultCode: http://xml.apache.org/axis/:HTTP faultString: Unauthorized
faultActor: null faultDetail: null: return code: 401 

When I try to run the code, this is because the <cfif
isDefined('cflogin') always fails. I do not know how to use the CFLOGIN
tag. All of the examples I have seen use form variables or url
variables, none use the authorization header. How do I get to the
username and password in the authorization header using CFLOGIN?

<cfset isAuthorized = false>

<cfif isDefined("cflogin")>
     <cfset isAuthorized = true>
     <cfquery name="authorize" datasource="goldcockerel">
          Select     id
          from     users
          where     username= '#cflogin.name#'
          and          password = '#cflogin.password#'
     </cfquery>
     <cfif authorize.recordcount>
          <cfset isAuthorized = true>     
  </cfif>
</cfif>

<cfif not isAuthorized>
     <cfheader statuscode="401">
     <cfheader name="WWW-Authenticate" value="Basic realm=""Test""">
     <cfabort>
</cfif> 

Giles Roadnight
http://giles.roadnight.name



-- 
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]

Reply via email to