3 Replies Latest reply on Oct 30, 2007 6:57 PM by bitwyse

    HTTPService

      Hi,

      I'm using an HTTPService and was wondering what is the best way to handle the problem if it can't connect to the server? Any help or sample code appreciated.

      Regards,

      Paul
        • 1. Re: HTTPService
          atta707 Level 2
          look at the fault event of HTTPSerive class.

          ATTA
          • 2. Re: HTTPService
            Gregory Lafrance Level 6
            This topic may be of particular interest:
            Handling result and fault events

            • 3. HTTPService
              bitwyse Level 1
              Hi,

              I use web services a lot. I have found a couple ways to do what your trying to do. The easiest way would be to declare a result handler and fault handler in the web service declaration. Here is some sample mxml code :
              <mx:WebService id="wsSomeWebServiceID"
              wsdl=" http://yourhost.domain.com/pathtoyourwsdl?wsdl"
              useProxy = "false"
              showBusyCursor = "true"
              fault="yourFaultHandler()" result="yourResultHandler()">
              <mx:operation name="yourWebServiceMethod()" >
              <mx:request/>
              </mx:operation>
              </mx:WebService>

              In your script code you will define the two handlers. In your handers you can grab the data as needed. Typically using the lastResult of the web service . method. For example. wsSomeWebServiceID.yourWebServiceMethod.lastResult......

              You can do all of this in Action Script as well. I don't have any short examples of this to show you as all my Action Script code is in the Cairngorm framework.

              Hope this helps.