import mx.remoting.Service; // import Service class
import mx.rpc.FaultEvent; // import FaultEvent class
import mx.remoting.PendingCall // import PendingCall clsas
import mx.rpc.ResultEvent // import ResultEvent class
import mx.rpc.RelayResponder // import RelayResponder class
mx.remoting.debug.NetDebug.initialize();
var myService:Service = new
Service("
http://examples.macromedia.com/flashservices/gateway",null,"petmarket.a
pi.catalogservice",
null, null); // connect to remote service
var pc:PendingCall = myService.getCatagories({locale:"en_US"}); // call
service method
pc.responder = new RelayResponder(this, "getData_Result", "getData_Fault");
trace( "no response from server yet." );
function getData_Result( re:ResultEvent ):Void { // receive result
trace( "got the response" );
}
function getData_Fault( fe:FaultEvent ):Void { // receive fault
trace( "got the response" );
}
try dumping this into a fla actionscript pane, save the fla and hit ctrl+Enter
- if you get something in your output window - you should be in business.
MX7 turns off some services by default - check
C:\JRun4\servers\cfusion\cfusion-ear\cfusion-war\WEB-INF\web.xml should contain
(uncommented) something like <init-param>
<param-name>gateway.configuration.file</param-name>
<param-value>/WEB-INF/gateway-config.xml</param-value>
</init-param>
<init-param>
<param-name>whitelist.configuration.file</param-name>
<param-value>/WEB-INF/gateway-config.xml</param-value>
</init-param>
<init-param>
<param-name>whitelist.parent.node</param-name>
<param-value>gateway-config</param-value>
</init-param>
to point at gateway-config.xml
which should itself have something like
<service-adapters>
<adapter>flashgateway.adapter.resultset.PageableResultSetAdapter
</adapter>
<adapter>coldfusion.flash.adapter.ColdFusionAdapter</adapter>
<adapter>coldfusion.flash.adapter.CFCAdapter</adapter>
<adapter>coldfusion.flash.adapter.CFSSASAdapter</adapter>
<!-- <adapter type="stateful-class">flashgateway.adapter.java.
JavaBeanAdapter</adapter> -->
<!-- <adapter type="stateless-class">flashgateway.adapter.java.
JavaAdapter</adapter> -->
<!-- <adapter type="ejb">flashgateway.adapter.java.EJBAdapter
</adapter> -->
<!-- <adapter type="servlet">flashgateway.adapter.java.ServletAdapter
</adapter> -->
<!-- <adapter>coldfusion.flash.adapter.CFWSAdapter</adapter> -->
</service-adapters>
with the cf-flash elements uncommented.
Unfortunately the old http://localhost/flashservices/gateway test doesnt work
anymore -
The information in this post came from the flashremoting section of the
coldfusion mx7 documentation in your webroot/cfdocs directory and there is
fairly thorough (if mainly flash 2004) flashremoting support (including simple
demos) in the flash 8 help.
Good Luck - Dan