flash & CFC
|
|
Thread rating:  |
rynomet - 04 Nov 2003 20:45 GMT all i want to do is see results from my query. i keep getting the same error: "Service threw an exception during method invocation: null". i've read countless articles and several books, all suggesting the same thing, but yet i can not seem to get any results.
i am able to connect to my remote CFC via the service browser, so i know flash sees it.
very basic code here:
#include "NetServices.as" #include "NetDebug.as"
gwurl = "http://www.mysite.com/flashservices/gateway/"; conn = NetServices.createGatewayConnection(gwurl);
srv = conn.getservice("cfc.miag2",this); srv.miagcompanies();
i am expecting to see 6 results from my miagcompanies query, but i cant seem to get past this error.
any help in the right direction is appreciated.. thanks!
ryan
Ned01 - 04 Nov 2003 21:44 GMT Ryan,
Your code looks fine. I used the exact same syntax and it worked for me. So, your problem is probably else where.
I assume that you got the error while using the netconnection debugger. What events do you see? Were any events successful? What are the details of the event that failed?
Regards,
Ned
rynomet - 04 Nov 2003 22:18 GMT in the netdebugging event summary this is what i see:
1. ConnectString: "http://www.mysite.com/flashservices/gateway/"
2. MethodName: "cfc.miag2.miagcompanies" Parameters (object #2) .....No properties
3. (information) -my debugging is enabled on my CF server what is this? Message: ColdFusion debugging is not enabled on the server. To receive ColdFusion debug events, please use the ColdFusion administrator to enable debugging.
4. AMF status call: MethodName: "/1/onStatus" ResponseURI: (undefined) Parameters (object #2) .....code: "SERVER.PROCESSING" .....description: "Service threw an exception during method invocation: null"
5. Status: Status (object #2) .....code: "SERVER.PROCESSING" .....description: "Service threw an exception during method invocation: null" .....details: "Service threw an exception during method invocation: null:coldfusion.runtime.AbortException:coldfusion.runtime.AbortException
#5 above appears twice, one after the other. and thats what i get every time. i read if you go to your gateway url, you should see a blank page - i am.
Ned01 - 05 Nov 2003 04:15 GMT You seem to have a data connection -- that's good,
Does your CFC work properly when called from a Cold Fusion page?
In the CFC function have you set access="remote"?
Are you providing any and all required arguments?
If not required are the defaults set properly?
Just a few thoughts. Post the CFC if you are still having problems...
Regards,
Ned
rynomet - 05 Nov 2003 15:42 GMT Does your CFC work properly when called from a Cold Fusion page? - YES
In the CFC function have you set access="remote"? - YES
Are you providing any and all required arguments? - No arguments, just a simple query
If not required are the defaults set properly?- Defaults? such as?
richardlmk - 05 Nov 2003 16:07 GMT Hello,
I'll be honest with you, today was my first day Remoting with Flash. But I just thought I'd add this as I received the same error when trying to retrieve a query from a cfc.
I found the problem to be in the multiple declarations of a connection, i.e. I was accessing two different cfc's using the same variables to store the connect and services. The solution was to add in an initiation piece of code:
if (inited == undefined) { var inited = true; #include "NetServices.as" #include "NetDebug.as"
gwurl = "http://www.mysite.com/flashservices/gateway/"; conn = NetServices.createGatewayConnection(gwurl);
srv = conn.getservice("cfc.miag2",this); }
srv.miagcompanies();
Which you have most probably seen before, and also to make sure that I didnt use "srv" or "conn" for any other services or cfc's.
Anyway, just a few more ideas...! Good luck.
rynomet - 06 Nov 2003 01:59 GMT still no luck...this is unbelievably frustrating. i cant proceed with my project until i can call data from my queries.
is there something on my MX server that is not allowing me to call my CFC? i may have to revert to macromedia support
thanks for your help
Ned01 - 06 Nov 2003 15:14 GMT Ryan,
One way to verify if your server is working is to connect to the CFC service by using the WebServiceConnector Flash component.
For an example of how to use the WebServiceConnector" study the "Tip of The Day" example on the MM web site. Part 2 illustrates how to connect to the "Tip of the Day" web service...
http://www.macromedia.com/devnet/mx/flash/articles/tipoday_pt2_02.html
You can create this service on a blank Flash slide. Follow the example to create a connection to the remote service. You should be able to browse the the "Tip of The Day" service from within the flash environment by using the WebServices tool. This is described in the sample application.
Once you know that this works, do the exact same thing for your web service by simply adding a second web service mapping. Be sure to follow the exact same syntax. By adding the ?WSDL after the address for your cfc, the coldfusion gateway will return a WSDL file.
If you can browse your CFC via the WebServices tool, your server is working normally.
I hope this helps.
Regards, Ned
rynomet - 06 Nov 2003 20:20 GMT Ned,
are you working with 2004 Pro? i am using 2004 MX and i cant locate this component in my panel.
ryan
Ned01 - 06 Nov 2003 20:45 GMT I am using MX 2004 Pro. I upgraded, since this seems to be where Macromedia is focusing their attention for remote data services... Read through the "Tip of the Day" example, and decide for yourself...
...Ned
Rubberneck - 07 Nov 2003 16:14 GMT Could you post your cfc function? I'm curious to see the CFC code and the query statement..
rynomet - 07 Nov 2003 16:45 GMT <cfcomponent>
<!--- returns all companies, no criteria needed- used for login page ---> <cffunction name="MIAGcompanies" access="remote"> <cfquery datasource="#application.ds3#" password="#application.dspass3#" username="#application.dsuser3#" name="qry_company"> SELECT code_Local, code_MIAG FROM view_CO_master_MIAG </cfquery>
<cfreturn qry_company> </cffunction> </cfcomponent>
Rubberneck - 08 Nov 2003 00:42 GMT I think the issue is with your dsn name. Coldfusion is trying to resolve anything inside the # signs. If you have a variable in application.cfm you would need to resolve it without "application" in the dsn. i.e. "#dn3#" instead of "#application.dn3#" I was able to get it to work with a dsn of "test" instead of "#application.dn3#".
Ned01 - 08 Nov 2003 12:15 GMT Ryan,
I think that the previous post is on to something. Try replacing all your variables with actual string values that you know work.
You may have to pass your data as an argument. As a rule, I use the cfargument tag and pass all my variables as a struct data type. This works equally well for the cfc whether it is called from Flash or a coldfusion page.
...Ned
rynomet - 08 Nov 2003 16:23 GMT thanks for all your help guys...i really appreciate it. what are requirements for having successful connection between flash and cfc? im running mx, and im using standard actionscript calling procedures. is there anything on the mx server i need to turn on?
after removing my application variables from my cfc i get a different error: "Service threw an exception during method invocation: Index: 144, Size: 65"
here is my updated code:
Flash:
#include "NetServices.as" #include "NetDebug.as"
if (inited == undefined) { var inited = true; gwurl = "http://www.mysite.com/flashservices/gateway/"; conn = NetServices.createGatewayConnection(gwurl); srv = conn.getservice("cfc.miag2",this); }
srv.miagcompanies();
CF component:
<cfcomponent>
<cffunction name="MIAGcompanies" access="remote"> <cfquery datasource="ds" name="qry_company" username="us" password="pass"> SELECT * FROM view_CO_master_MIAG </cfquery> <cfreturn qry_company> </cffunction> </cfcomponent>
Ned01 - 08 Nov 2003 23:23 GMT Ryan,
After looking at your code, I suggest you try a few more things...
1. Actionscript 2 is case sensitive, I noticed that in 'srv.miagcompanies();' and in '<cffunction name="MIAGcompanies" access="remote">', 'MIAGcompanies' do not match in case. This will cause an error for me. So check the case in all references in AS2.
2. You might add returnType="query" to the cffunction tag. Most examples include this, but I am not sure it is required.
3. Since I do not know what else to suggest, you might try relaoding the Flash Remoting for MX 2004 directly from the MM website
http://www.macromedia.com/devnet/mx/flashremoting/
This is different from the components for MX. (I am sure you knew that)
Keep us posted, and remember -- it does really work. I use it all the time!
Regards,
Ned
rynomet - 09 Nov 2003 23:00 GMT this is unbelievably frustrating!!!!! 2 weeks trying to get this to call a stupid query
with the same code, why would i get: "ConnectString: "http://www.mysite.com/flashservices/gateway" from the debugger and nothing else!?
i actually called macromedia support. they were anything but that. im almost about to give up on this :*(
jeffcg2 - 09 Nov 2003 23:15 GMT Have you checked these links?
I haven't read all the postings in this thread yet but I keep these links in my favorites. Because they were where I finally found the answer to get webservices to run anywhere other that localhost:o)
There are a couple of .bat files to run that I'll see where they are located.
Jeff Craig ICQ# 51303123
Referring URLs http://www.macromedia.com/support/flash_remoting/ts/documents/cfmx_fr_checklist.htm http://www.macromedia.com/support/flash_remoting/ts/documents/iis_gateway_connec tion.htm
Rubberneck - 10 Nov 2003 04:33 GMT I'd try putting a trace( "inside miagcompanies_result()" ) to see if you aree getting data back from the CFC function call. It looks like your not connecting though, with the connect string error you discribe.
rynomet - 10 Nov 2003 16:46 GMT very good articles. i visited the one on flash remoting help previously, and the connector article ended up not being the issue. I do have the jrun file in all of my sites and even after removing and adding in, still receive same error.
not that it should matter (or maybe it will) im going to reinstall my MX server and apply 6.1
rynomet - 15 Jan 2004 16:30 GMT After a month and a half of putting flash aside my partner and i were able to finally call a CFC using flash remoting. the solution seems simple although i havent heard or seen that this is required in any documentation. we placed an "application.cfm" file in our CFC directory and that solved everything. our application.cfm file in this directory is even blank (for now).
is this true with those that had previous success? do you have an application.cfm file in the directory that contains your CFC?
thanks!
ryan
Dross.2 - 16 Jan 2004 17:56 GMT the reason this was happening was because you were trying to use the application scope without it really existing. Putting application.cfm in the directory with your cfc created the application scope (although I would have thought you would need the cfapplication tag as well).
Your cfcs should typically be part of an application, and as long as they are nested within a folder structure that has an application.cfm somewhere above them, they can use the application scope. Otherwise, they can't.
On another note, you should probably use the variables scope for those vars and set them outside of the cffunction. That way they are local to the cfc and you are not accessing a shared scope variable everytime that query gets run.
phil ashby - 28 Jan 2004 15:06 GMT try creating a CFM page that calls the function to see if it's a problem with that...eg
<html> <body>
<cfinvoke component="comp_name" method="func_name" returnvariable="ret_var" >
</cfinvoke> <cfdump var="#ret_var#"> </body> </html>
if you have any parameters include
<cfinvokeargument name="param_name" value = "param_value">
inside the cfinvoke tag
make returnvariable = the same as the return from your function.
Ensure your IP is listed on the CF admin debug settings and if the function is failing you'll get the debug messages which are a damn sight more useful then the Flash Net Debugger ones. It will also dump out the return from your query.
Graham Pearson - 10 Nov 2003 13:40 GMT In your web browser when you pull up http://www.mysite.com/flashservices/gateway/ what do you get in your browser? I would suspect that you would get an error message back from your server instead of a blank page.
I have ran into all of these issues and solved them. Just like this one:
> "Service threw an exception during method invocation: Index: 144, Size: 65" Which how I solve it is to delete all files in the C:\CFusionMX\wwwroot\WEB-INF\cfclasses as it says that the previous compiled page was 14K in size and the new page is 65 in size.bytes and the new size is 6K
> thanks for all your help guys...i really appreciate it. what are requirements for having successful connection between flash and cfc? im running mx, and im using standard actionscript calling procedures. is there anything on the mx server i need to turn on? > [quoted text clipped - 28 lines] > </cffunction> > </cfcomponent> Graham Pearson - 10 Nov 2003 13:42 GMT Are you testing the Flash File from inside of flash or via a website?
> Ned, > > are you working with 2004 Pro? i am using 2004 MX and i cant locate this component in my panel. > > ryan rynomet - 10 Nov 2003 23:03 GMT im doing everything from within Flash.
and i dont receive an error when visiting http://www.mysite.com/flashservices/gateway... i see a blank page..
let me try to remove those files and ill see what it says..
|
|
|