Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

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.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Indigo

WCF and callbacks

Update your Vista Drivers Update Your Drivers Now!!
 
 
Thread Tools Display Modes
Old 12-08-2007   #1 (permalink)
Mike
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 SpecsSystem Spec
Old 12-10-2007   #2 (permalink)
Shimon Sim
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 SpecsSystem Spec
 

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


Vistax64.com 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 2005-2008

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 47 48 49 50 51