![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | WCF and callbacks Hi, I’m having some trouble with call backs. When I invoke a method in the service that has a call back method wired to it, everything works fine. When I fire an event due to some internal action in the service (here the client didn’t request anything) I get an error trying to send the callback back to the client. I think it make sense, what client right? My service is a singleton and no client is making a request to it, the event is supposed to be fired due to an internal event in the service. This is part of my code: THIS IS THE SERVICE CONTRACT <ServiceContract(CallbackContract:=GetType(IActiveDialerServicesCallBack ))> _ Public Interface IActiveDialerServices ….. End Interface THIS IS THE CALLBACK INTETRFACE Public Interface IActiveDialerServicesCallBack <OperationContract(IsOneWay:=True)> _ Sub OnUserAuthentication(ByVal Msg As String) <OperationContract(IsOneWay:=True)> _ Sub OnManuallyRequestedNextCallSuccess(ByVal Prospect As Prospect) <OperationContract(IsOneWay:=True)> _ Sub OnManuallyRequestedNextCallFailure(ByVal Msg As String) <OperationContract(IsOneWay:=True)> _ Sub OnSaveSuccess(ByVal Msg As String) <OperationContract(IsOneWay:=True)> _ Sub OnSaveFailure(ByVal Msg As String) <OperationContract(IsOneWay:=True)> _ Sub OnDialing(ByVal Msg As String) End Interface In this Event call is where I get the error. This event gets called by another internal event of the service. Private Sub OnDialing(ByVal Msg As String) Try Here is where I get the error ------à Dim callback As IActiveDialerServicesCallBack = OperationContext.Current.GetCallbackChannel(Of IActiveDialerServicesCallBack)() callback.OnDialing(Msg) Catch ex As Exception End Try End Sub When I debug OperationContext.Current.GetCallbackChannel(Of IActiveDialerServicesCallBack)() is equl to NOTHING! I guess what I need is being able to fire an event and a client to receive it, buy with out the client requesting anything in the first place. Thanks for your help Mike |
My System Specs![]() |
| | #2 (permalink) |
| Guest | Re: WCF and callbacks First all the clients need to call into service and "Register with it" so you can save references to the clients and use those for your call. You can't just create client on server. Server has no Idea what and where is the client. By the way you may have a lot of clients so you will need to use some kind of List of Clients. Hope helps. Shimon "Mike" <mike@xxxxxx> wrote in message news:A5AF2E839E0E438CB297E554FF38C1D3@xxxxxx Hi, I'm having some trouble with call backs. When I invoke a method in the service that has a call back method wired to it, everything works fine. When I fire an event due to some internal action in the service (here the client didn't request anything) I get an error trying to send the callback back to the client. I think it make sense, what client right? My service is a singleton and no client is making a request to it, the event is supposed to be fired due to an internal event in the service. This is part of my code: THIS IS THE SERVICE CONTRACT <ServiceContract(CallbackContract:=GetType(IActiveDialerServicesCallBack))> _ Public Interface IActiveDialerServices ... End Interface THIS IS THE CALLBACK INTETRFACE Public Interface IActiveDialerServicesCallBack <OperationContract(IsOneWay:=True)> _ Sub OnUserAuthentication(ByVal Msg As String) <OperationContract(IsOneWay:=True)> _ Sub OnManuallyRequestedNextCallSuccess(ByVal Prospect As Prospect) <OperationContract(IsOneWay:=True)> _ Sub OnManuallyRequestedNextCallFailure(ByVal Msg As String) <OperationContract(IsOneWay:=True)> _ Sub OnSaveSuccess(ByVal Msg As String) <OperationContract(IsOneWay:=True)> _ Sub OnSaveFailure(ByVal Msg As String) <OperationContract(IsOneWay:=True)> _ Sub OnDialing(ByVal Msg As String) End Interface In this Event call is where I get the error. This event gets called by another internal event of the service. Private Sub OnDialing(ByVal Msg As String) Try Here is where I get the error ------à Dim callback As IActiveDialerServicesCallBack = OperationContext.Current.GetCallbackChannel(Of IActiveDialerServicesCallBack)() callback.OnDialing(Msg) Catch ex As Exception End Try End Sub When I debug OperationContext.Current.GetCallbackChannel(Of IActiveDialerServicesCallBack)() is equl to NOTHING! I guess what I need is being able to fire an event and a client to receive it, buy with out the client requesting anything in the first place. Thanks for your help Mike |
My System Specs![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| WCF Remote Client Callbacks using wsDualHttpBinding | lmod | .NET General | 1 | 08-22-2008 04:06 AM |
| Cmdlet, CallBacks and EndProcessing | Doug | PowerShell | 0 | 11-29-2006 11:00 AM |