0 Replies Latest reply on Sep 28, 2006 2:12 AM by alanskinner

    Webservice doesnt work if created in a class

    alanskinner

      Hi I am trying to wrap some wwebservice code in a class to make itmore generic and usefull to me later. but it does work

      if i use

      var wsh:WebServiceHelper = new WebServiceHelper("MYURL");

      with the class pasted below all i get is..


      WSDL: Unable to receive WSDL file
      Web service was not found
      faultactor: undefined
      faultNamespaceURI: undefined
      element: undefined
      detail: Unable to load WSDL, if currently online, please verify the URI and/or format of the WSDL
      faultstring: Could not load WSDL
      faultcode: Client.Disconnected
      9/28 10:11:54 [DEBUG] : Service stub found fault upon receiving WSDL: Could not load WSDL

      Any reasons why?

      Cheers

      ****CLASS FILE WebServiceHelper.as***8
      import mx.services.WebService;
      import mx.services.Log;
      import mx.utils.Delegate;

      class WebServiceHelper extends MovieClip
      {
      var url:String;
      var foundWsdl:Boolean = false;
      var ws:mx.services.WebService;
      var myWebSrvcLog:mx.services.Log;

      function WebServiceHelper(_url:String)
      {
      url = _url;

      myWebSrvcLog = new Log(Log.DEBUG);
      myWebSrvcLog.onLog = function(txt)
      {
      trace(txt)
      }

      ws = new WebService(url, myWebSrvcLog);
      trace(url + " " + ws);
      ws.onLoad = Delegate.create(this, foundWs);
      ws.onFault = Delegate.create(this, notFoundWs);
      //ws.onLoad = foundWs;
      //ws.onFault = notFoundWs;
      }

      function foundWs()
      {
      trace("foundWs");
      }

      function notFoundWs(fault)
      {
      trace("Web service was not found");
      for (var t in fault)
      {
      trace(t + ": " + fault[t]);
      }
      }

      }