Groups | Blog | Home
all groups > macromedia flash flash remoting > may 2004 >

macromedia flash flash remoting : Not Authorized!?!?!


CF_Admin
5/7/2004 8:39:14 AM
For the life of me I can't figure out why this default responder won't work,
but it stops right after it sends the data. I get all the traces up to the 2
variables being sent... but it never gets to trace("trouble"), which didn't
surprise me since it obviously wasn't running _result and retrieving the query.
I've been over it a 100 + times tonight and I can't find anything wrong with
the code... PLEASE some one help

Thanks

Here's the Action Script"

function getLogin() {

if (uname_l == null) {
Selection.setFocus("_root.uname_l");
login_e = ("user name is a required field.");

}

else if (passw_l == null) {
Selection.setFocus("_root.passw_l");
login_e = ("password is a required field.");
}

else {
login.getAuth(uname_l,passw_l);
login_e = ("");
trace ("gets here");
trace (uname_l);
trace (passw_l);
}
}
function getAuth_Result(result){
trace ("trouble");
if (reslut == null){
login_e = ("user name password combo is invalid. try again.");
}
else {
getURL("chat.swf?uid="+result.items[0].userid, this);
trace (result.items[0].userid);
}
}

and here's the CF component (I stipped it down to a bare minimum trying to
debug this, and tested the query in a cfm page with an html form submission
using the same variable names... it works fine):

<cfcomponent>
<cffunction name="getAuth" access="remote" returntype="query">
<cfquery name="q_loginQuery" dataSource="poetry_users">
SELECT userid, user_name
FROM user
WHERE
user_name='#uname_l#'
AND password='#passw_l#'
</cfquery>
<cfreturn q_loginQuery>
</cffunction>
</cfcomponent>

Anyone have any ideas... I don't get any errors from NetServices. It seems to
connects to the CF Component fine. Did I miss a bracket or something stupid...
I've looked at all of that more for hours now, and checked the syntax against
tutorials and documentaion... it looks like it should work to me... the same
syntax works perfectly in the registration part of this app.!?

Thanks again! for any help
CF_Admin
5/7/2004 9:04:35 AM
Just to clearify. The first function runs:

function getLogin() {

if (uname_l == null) {
Selection.setFocus("_root.uname_l");
login_e = ("user name is a required field.");

}

else if (passw_l == null) {
Selection.setFocus("_root.passw_l");
login_e = ("password is a required field.");
}

else {
login.getAuth(uname_l,passw_l);
login_e = ("");
trace ("gets here");
trace (uname_l);
trace (passw_l);
}
}

I get this far and see all 3 traces in the output window

This is what is not running for no reason that I can tell:

function getAuth_Result(result){
trace ("trouble");
if (reslut == null){
login_e = ("user name password combo is invalid. try again.");
}
else {
getURL("chat.swf?uid="+result.items[0].userid, this);
trace (result.items[0].userid);
}
}

It does not get to trace ("trouble");... this is how I would like it look, btu
I have striped this down to notheing but trace ("trouble");. I've compared to
others I've done, and referenced tutorials.. it all looks good to me.

HELP!!! Please,

Thank you!

CF_Admin
5/7/2004 3:16:15 PM
Hi everyone,

I'm sure that this one is something stupid like a typo... but after FINALLY
getting a few hours sleep, I still don't see what's wrong or where. I use
almost exactly the same function for the registration that calls the login
page, and it works fine (the only difference reaally is here I don't return a
query, only a numeric code, but I even tried doing that just as a test):

function putUser_Result(result){
if (result == 1) {
error_message.text = "That user name is taken, please try again";
}
else if (result == 9) {

getURL("login.swf?user="+uname, this);

Can some please help me!?

Thanks all!

CF_Admin
5/7/2004 3:20:25 PM
Just for the record, I caught this typo earlier:

if (reslut == null){

CF_Admin
5/7/2004 5:19:55 PM
Is everyone as stumped as me, or is the answer so obviouse that no one wants to
answer?

Here is the entire ActionScript in it's current form if that might help:

stop();

#include "NetServices.as"
#include "DataGlue.as"
if (isGatewayOpen == null) {
// do this code only once
isGatewayOpen = true;

NetServices.setDefaultGatewayUrl("http://127.0.0.1:8500/flashservices/gateway");
gatewayConnnection = NetServices.createGatewayConnection();
register = gatewayConnnection.getService("poetry.login", this);
}
if (user == undefined) {
Selection.setFocus("_root.uname_l");
}
else {
u_name_l.text = user;
Selection.setFocus("_root.passw_l");
}


function putLogin() {

if (uname_l == null) {
Selection.setFocus("_root.uname_l");
login_e = ("user name is a required field.");

}

else if (passw_l == null) {
Selection.setFocus("_root.passw_l");
login_e = ("password is a required field.");
}

else {
login.getLogin(uname_l,passw_l);
login_e = ("");
trace ("gets here");
trace (uname_l);
trace (passw_l);
}
}

function getLogin_Result(result) {
trace ("trouble");
}

Someone please help... I have to get this to work!!!
CF_Admin
5/7/2004 6:24:10 PM
OK I got it:

2 things

1)

<cfcomponent>

<cffunction name="getUserID" access="remote" returntype="query">
[b]<cfargument name="uname_l" type="string" required="true" />
<cfargument name="passw_l" type="string" required="true" />[/b]
<cfquery name="q_loginQuery" dataSource="poetry_users">
SELECT userid, user_name
FROM user
WHERE
user_name='#uname_l#'
AND password='#passw_l#'
</cfquery>
<cfreturn q_loginQuery>


</cffunction>
</cfcomponent>

Needed cfargument in the cfc file.

2)

register = gatewayConnnection.getService("poetry.login", this);

should have been

[b]login[/b] = gatewayConnnection.getService("poetry.login", this);

I knew it was something stupid...

I was using cfargument before, and stripped it out during testing, so really
it was # 2... I had not decalred the correct variable for the CF component in
the gatewayConnnection statement.

I hope this at least helps someone else!

Thanks all

AddThis Social Bookmark Button