1 Reply Latest reply on Nov 18, 2010 5:27 PM by alinator11

    ActionScript Web Service Never Reports Ready

    alinator11 Level 2

      Hi,

       

      I have a web service running where I can see the wsdl via the browser but the SWF never gets there.


      The SWF is deployed on the same Tomcat server where the WSDL is. The SWF is being loaded on facebook. However, it is loaded via an iframe so it should not be a cross domain issue (right?). Please tell me what I am doing wrong in the following code. Any help is very much appreciated. service.ready never returns true and my Map keys are all null. I see no logs in Apache from where the SWF has gotten the WSDL (although I do see log entries from where I have put the WSDL address in my browser).

       

          public class UIServiceCalls
          {
              private var serviceLocation:String = "http://blah/service?wsdl";
              private var service:WebService;
              private var operation:AbstractOperation;
              private var operationArgs:Object = new Object();
              private var serviceStarted:Boolean = false;
             
              /**
               * Default constructor starts the service that is added as a static member
               * to this object.
               * **/
              public function UIServiceCalls()
              {           
                  startService();
              }
             
              /**
               * This is where the service starts up. Messages added so you can see what is happening in the UI.
               * ***/
              private function startService():void {
                  if(service == null) {
                      service = new WebService();
                      service.loadWSDL(serviceLocation);                               
                  }           
                  if(!service.ready) {
                      Alert.show("Service is not ready: ");
                  }
                  if(service.ready) {
                      serviceStarted = true;
                  }   
              }      

             
              /**
               * Sets the code upon log in and gets back the web service Object. Object
               * contains Object.xxx and Object.yyy.
               * **/
              public function getUserInfo(c:String, i:String):Object {
                  if(!serviceStarted) {
                      startService();
                  }           
                  operation = service["getUserInfo"];           
                  operationArgs.c = c;
                  operationArgs.i = i;
                  operation.arguments = operationArgs;           
                  return operation.send().result;           
              }

        • 1. Re: ActionScript Web Service Never Reports Ready
          alinator11 Level 2

          I finally got the SWF to at least request the web-service. I can see it in the logs of my Tomcat server:

           

          00.000.00.000 - - [18/Nov/2010:19:12:32 -0600] "GET /blah/service?wsdl HTTP/1.1" 200 2950

           

          The SWF finally got the service, but I'm still getting null responses, the service is still never reporting ready and it is certainly never returning anything. I can see the wsdl if I go to it in the browser. I can see that the web-server is responding to the SWF with it and has a status message of "200". Can anyone give advice on what could possibly be wrong?

           

           

           

          private function startService():void {

           

          if(service == null) {

          service =

          new WebService();

           

          //service.loadWSDL(serviceLocation);

          service.wsdl = serviceLocation;

          service.loadWSDL(serviceLocation);

          service.initialize();

           

           

          var a:Array = service.headers;

           

          var h:String = "";

           

          for(var i:uint = 0; i < a.length; i++) {

          h = h +

          " " + String (a[i]);

          }

          Alert.show(

          "Headers: " + h);

          }

           

          if(!service.ready) {

          Alert.show(

          "Service is not ready: ");

          }

           

          if(service.ready) {

          serviceStarted =

          true;

          }

          }

           

          FYI, when I did not set service.wsdl and then call service.loadWSDL as you see above, the wsdl was never requested from Tomcat. All that happens when I run the above is I get "Headers: null" and "Service is not ready" - I get "Service is not ready" twice due to the method that runs directly after this one. That is where I try to get service values. But, since I apparently have no service, I never get any values...

           

           

          public function getUserInfo(c:String, i:String):Object {

           

          if(!serviceStarted) {

          startService();

          }

          operation = service[

          "getUserInfo"];

          operationArgs.c = c;

          operationArgs.i = i;

          operation.arguments = operationArgs;

           

          return operation.send().result;

          }