1 Reply Latest reply on Oct 1, 2007 8:44 AM by mae@ccg

    WebService fault "design pattern"

    mae@ccg Level 1
      My flex app has about a dozen calls to various .net web services that I've developed. If the user's session has timed out (a client requirement) I have the web service throw a SoapFault.

      Right now, I've hard-coded a fault event for each web service that opens a login panel. I've also hard coded an event handler to the login panel that re-calls the original request. So the flow is something like this:

      1. Call ws1.send()
      2. Web service generates fault, handled by ws1_onFault event
      3. ws1_onFault opens a loginPanel (a custom mxml component) and adds a event handler ws1_onLogin
      4. ws1_onLogin calls ws1.send()

      My problem is that this is a lot of the same code getting copied around. Is there a better (e.g. OOP) was to refactor things out? My other problem is that sometimes I've got parameters in step one that need to preserved all the way through to step 4.

      Any help/pointers/suggestions would be greatly appreciated.

      Thanks!
        • 1. Re: WebService fault "design pattern"
          mae@ccg Level 1
          OK, here's what I've tried - any comments or suggestions?

          1. Create async token, set it equal to ws1_send(), set original parameters as dynamic properties
          2. In ws1_onFault, pass token as property to the loginPanel
          3. loginPanel raises a loginEvent with a property equal to the token
          4. ws1_onLoginEvent gets token, calls ws1_send with stored parameters

          Thanks.