Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Indigo

Vista - WCF and callbacks

 
 
Old 12-08-2007   #1 (permalink)
Mike


 
 

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 SpecsSystem Spec
Old 12-10-2007   #2 (permalink)
Shimon Sim


 
 

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 SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
WCF Remote Client Callbacks using wsDualHttpBinding .NET General
Cmdlet, CallBacks and EndProcessing PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46