Question

I am trying to connect my flex app to a CFC I have which calls a method. It's to test a login control, and when i put the correct credentials in, it comes back with the error: "SOAP Response cannot be decoded. Raw response: ".

The CFC method is:

    <!--- Array of Users is called --->
    <cfset user = EntityLoad( "User", {emailAddress='#arguments.emailAddress#', password='#arguments.password#'}, true ) />
    <cfset returnvar = "false"/>    
    <cftry>
        <cfif user[1].firstName>
            <cfset returnvar = "true"/>                 
        <cfelse>
                <cfset returnvar = "true"/> 
        </cfif>                     
    <cfcatch type="any">
        <cfset returnvar = "false"/>    
    </cfcatch>
    </cftry>


            <cfreturn returnvar />
</cffunction>

I am not sure how to decore this. The CFC method returns back a string, which i use as a flag. Should that be changed? Thanks guys

Was it helpful?

Solution

Here is what I think is happening:

1: A user is returned ("Bob")

2: CF tries to evaluate user[1].firstname as a boolean, but Bob is not a boolean

3: The returnvar is set to false, but the error stops the function from continuing processing (this is a guess)

4: The expected value type is not returned to Flex, so Flex errors

First, I'd test step 3 by changing the catch block to

<cfcatch><cfreturn "false"></cfcatch>

Then, instead of switching on user[1].firstname, I'd switch on user.recordcount.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top