Use the delegate in the ActualWebService class -- reference it in foo.

∞ Andy Badera
∞ +1 518-641-1280
∞ This email is: [ ] bloggable [x] ask first [ ] private
∞ Google me: http://www.google.com/search?q=(andrew+badera)+OR+(andy+badera)



On Thu, Sep 3, 2009 at 11:19 AM, rbr<[email protected]> wrote:
>
> Hello all,
>
> I have a webservice that is being called through anouther class and
> would like to subscribe to the asynch callback event on the service
> proxy.
>
> Psuedo code:
>
> class foo
> {
>     public voidCallIntClassWS(int param)
>     {
>          return intClass.CallWSAsych(param);
>     }
> }
>
> class WebServiceIntermediateSvcClass
> {
>     ActualWebService ws = new ActualWebService();
>
>     public foo()
>     {
>          ws.AsynchEvent += new AsychEventEventHandler
> (ws_AsynchEventCompleted);
>     }
>
>     public void CallWSAsynch(int param)
>     {
>          ws.ActualCallAsynch(param);
>     }
>
>     private void ws_AsynchEventCompleted(object sender,
> AsynchCallCompletedCompletedEventArgs e)
>     {
>          //Do Stuff
>      }
> }
>
> class ActualWebService
> {
>          public event AsynchCallCompletedEventHandler
> AsynchCallCompleted;
>          public delegate void AsynchCallCompletedEventHandlerr(object
> sender,  AsynchCallCompletedCompletedEventArgs e);
>
>          public void ActualCallAsnch(int param)
>          {
>               //invoke webservice call
>          }
> }
> }
>
> I believe I covered everything here. Hopefully this is enough as the
> actual code is very long and complex.
>
> As you can see, we are using an intermediate service class that
> actually brokers the call to the webservice. Currently that service
> class subscribes to the completed event. I would like to have the top-
> level class (Foo) actually handle the callback. Is there a way to do
> this?
>
> Any suggestions would be greatly appreciated.
>
> Best regards and thank you in advance!
>
> rbr
>

Reply via email to