views:

24

answers:

2

I am trying to figure out how to define a callback to my model object, via the Mate Frameworks LocalEventMap.

<EventHandlers type="{WebServiceEvent.RT_GET}" debug="true">
    <HTTPServiceInvoker url="/services/rtGet.asp">
        <resultHandlers>
            <CallBack method="rtGetHandleResult" arguments="{resultObject}"/>
        </resultHandlers>
        <faultHandlers>
            <CallBack method="rtGetHandleFault" arguments="{fault}"/>
        </faultHandlers>
    </HTTPServiceInvoker>
</EventHandlers>

The event is originally dispatched from the model, via the views (as the models dispatcher property). However, when the callback is ready to fire, I get the following error.

---------------------------------------------------------
- ERROR: Method rtFeesGetHandleResult not found in class OrderEntryView_0_Main 
- EVENT TYPE: "WebstoreServiceEvent.RT_FEES_GET" (rtFeesGet) 
- TAG: CallBack 
- METHOD: rtFeesGetHandleResult
- FILE: OrderEntryEventMap
- 1 ARGUMENT SUPPLIED: [object Object]
---------------------------------------------------------

I get essentially the same error if I try to make method="model.rtGetHandleResult"

So, in keeping with the presentation model... how do I have the event map get this to the model to execute?

A: 

One possibility would be to create a 'pass-through' function on the view object, to hand the resultObject off the the model for handling.

reidLinden
Well, it seems to work, anyhow. But, is there a better way?
reidLinden
A: 

Yes, there is a better way. In my case, there was no actual NEED to have the <resultHandler /> issue a <callback />. Simply replace the callback with methodInvoker, and add a generator property to it, pointing at the model in question.

Now, if you really DO need a callback to work this way, I am pretty convinced by now that a pass-through function of some kind is your only way forward.

reidLinden