Skip to main content
June 29, 2009
Question

FMS http connect fail

  • June 29, 2009
  • 1 reply
  • 1204 views

I try to use Flash remoting in FMS, the result in log is showing "Empty reply from server".

even I use LoadVar() object or web service to connect to local application server (weblogic), it is not working .

I don't know why, can someone help me!!

Thanks,

Jason

    This topic has been closed for replies.

    1 reply

    June 29, 2009

    I've had no problems with LoadVars or NetServices. Can you post your code?

    June 29, 2009

    code is here:

    //need to load this library
    load( "NetServices.asc" );

    var client;
    var returnStr;

    //this gets call when the application gets instantiated in the comm server
    application.onAppStart = function()
    {
            trace("-Application has started :::");
    }
    application.onConnect = function( pClient  ) {
       
        trace("onConnect: "+ pClient );
      
        //application.acceptConnection( pClient );
        this.acceptConnection( pClient );
        client = pClient;
    }
    Client.prototype.serverHelloMsg = function( helloStr ) {
            trace("serverHelloMsg---");
            trace("IN GET remoting..." );
           
                 // We create a new object that will handle the result of the Flash Remoting
                 var myResult = new Object();
                 // This is the result handler that will execute when the data is loaded in from
                 // the Flash Remoting.  To return the data to the client, we execute client.call()
                 // which calls the function 'dataFromServer' from NetConnection.client
                 myResult.onResult = function (data) {
                       trace("Data received from Server : " + data);
                       returnStr = data;

                 };
                 // This is the fault handler for the Flash Remoting.  If this is executed it calls
                 // a client.call() which calls teh function 'traceFromServer' from NetConnection.client
                 // This sends the error message to the trace panel.
               myResult.onStatus = function (info) {
                   trace("An error occurred : " + info.description);
                             };

               NetServices.setDefaultGatewayUrl( "http://localhost:8080/flashRemoApp/gateway" );
               trace("Calling flash gateway...");
               var myServer = NetServices.createGatewayConnection();
               trace("Calling createGatewayConnection...");
               var myService = myServer.getService("/flashRemoApp/flashRemoServlet", myResult);
               trace("After getService...");
               myService.flashRemoServlet("testing remoting...");
      
        return "Hello, " + returnStr + "!";
    }

    June 29, 2009

    I bet it's a scope problem. Both the responder and the call to the service are within the scope of the Client.prototype.serverHelloMsg method, so once the method is done running, those references are gone.

    Try defining your webservice request and response outside of the function, in the scope of either the application or the client object. That way, when the function is done running, the call and responder won't be lost.