Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: why onFault not call?  (Read 6968 times)
czw888
Newbie
*
Posts: 7


View Profile Email
« on: April 08, 2010, 06:29:58 »

I have a difficult to use puremvc+Blazeds now . First see blow's code:
OrgchartDelegate:
:
package com.czw.apps.cbank.model.business
{
    import com.czw.apps.cbank.model.vo.OrgchartVO;
   
    import mx.rpc.IResponder;
    import mx.rpc.remoting.RemoteObject;

    public class OrgchartDelegate
    {
       private var responder:IResponder;
       private var service:Object;
       
       public function OrgchartDelegate(responder:IResponder)
       {
           service=new RemoteObject();
           service.destination="myOrgchartLogicFlex"; 
           service.makeObjectsBindable=true; 
           service.showBusyCursor=true; 
           this.responder=responder;   
       }
       
       public function getAllOrgchart():void{
           
           var call:Object=service.getAllOrgchart();
           call.addResponder(this.responder);
       }
       
       public function getParentOrgchart(departmentid:String):void{
           var call:Object=service.getAllOrgchart(departmentid);
           call.addResponder(this.responder);
       }
       
       public function updateOrgchart(orgchartVO:OrgchartVO):void{
           var call:Object=service.updateOrgchart(orgchartVO);
           call.addResponder(this.responder);
       }
       
    }
}
OrgchartProxy:
:
package com.czw.apps.cbank.model
{
    import com.czw.apps.cbank.ApplicationFacade;
    import com.czw.apps.cbank.model.business.OrgchartDelegate;
    import com.czw.apps.cbank.model.vo.OrgchartVO;
   
    import mx.collections.ArrayCollection;
    import mx.rpc.Responder;
    import mx.rpc.events.FaultEvent;
    import mx.rpc.events.ResultEvent;
    import mx.controls.Alert;
   
    import org.flexunit.runner.Result;
    import org.puremvc.as3.interfaces.IProxy;
    import org.puremvc.as3.patterns.proxy.Proxy;

    public class OrgchartProxy extends Proxy implements IProxy
    {
       public static const NAME:String="OrgchartProxy";
       public var errorStatus:String;
       public var currentOrgchart:OrgchartVO;
       
       
       public function OrgchartProxy(data:Object=null)
       {
           super(NAME,data);
           
       }
       
       public function getAllOrgchart():void{
           var delegate:OrgchartDelegate=new OrgchartDelegate(new Responder(ongetAllOrgchartResult,onFault));
           delegate.getAllOrgchart();
       }
       
       public function ongetAllOrgchartResult(event:ResultEvent):void{
           data =event.result as ArrayCollection;
           this.sendNotification(ApplicationFacade.GET_ALL_ORGCHART_SUCESS);
       }
       
       public function getParentOrgchart(departmentid:String):void{
           var delegate:OrgchartDelegate=new OrgchartDelegate(new Responder(ongetParentResult,onFault));
           delegate.getParentOrgchart(departmentid);
       }
       
       public function ongetParentResult(event:ResultEvent):void{
           currentOrgchart=event.result as OrgchartVO;   
           this.sendNotification(ApplicationFacade.GET_PARENT_ORGCHART_SUCESS);
       }
       
       public function updateOrgchart(orgchartVO:OrgchartVO):void{
           var delegate:OrgchartDelegate=new OrgchartDelegate(new Responder(onUpdateResult,onFault));
           delegate.updateOrgchart(orgchartVO);
       }
       
       public function onUpdateResult(event:ResultEvent):void{
           this.sendNotification(ApplicationFacade.UPDATE_ORGCHART_SUCESS);
       }
       
       public function onFault(event:FaultEvent):void{
           this.errorStatus=event.fault.faultString;
           Alert.show(this.errorStatus,"Error");
       }
       
       public function get orgchartList():ArrayCollection{
           return data as ArrayCollection;
       }
       
       
    }
}
if call OrgchartProxy .getAllOrgchart()when I disconnection the database,the getAllOrgchart function will call onFault function. but if call OrgchartProxy.updateOrgchart(vo) when I disconnection the database,the updateOrgchart function not call onFault.
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: April 09, 2010, 07:46:12 »

Sounds like your getAllOrgChart call is failing and your updateOrgchart function is not failing. I suggest using the debugger to set breakpoints on the onFault and onUpdateResult methods to see which is called.

-=Cliff>
Logged
Pages: [1]
Print