call from a webservice to a windows Form

  • Thread starter Thread starter Richard Kure
  • Start date Start date
R

Richard Kure

Is it possible to get a webservice to call to a Windows Form? Both the
webservice and the form are running at the same computer.

I work in C#.NET in Visual Studio. I tried to make an eventin the
webservice, which to form should listen to. But you cant see the event when
you add the webservice to the form project. The only event I could see was
'Dispose'. So it looks like it is possible to make events in a webservice,
when it has the 'Dispose' itself, but how to make it?


ex.

public delegate bool ErrorReceivedHandler(object sender, MessageEventArgs
e);

public class Test : System.Web.Services.WebService
{

public event ErrorReceivedHandler errorReceived;

public bool onErrorReceived(ErrorMessageArrayEventArgs e)
{
if (errorReceived != null)
{
return errorReceived(this, e);
}
else
{
return false;
}
}

[WebMethod]
public bool sendMessage(string message)
{
return this.onErrorReceived(this, new EventArgs())
}


But you couldn't see the event 'errorReceived', when you add the reference
in the form project.
 
Richard,

You can not do this using web services in .NET right now. There will be
support later for events in web services (I believe), in Indigo, when the
new WS-* initiatives are implemented, but right now, you can not do it.

If you want to use an event model, then you should use remoting.

Hope this helps.
 
If they're running on the same computer why use web services? Use
something more efficient like remoting or named pipes, both of which
offer two-way communications.

Sam


Is it possible to get a webservice to call to a Windows Form? Both the
webservice and the form are running at the same computer.

B-Line is now hiring one Washington D.C. area VB.NET
developer for WinForms + WebServices position.
Seaking mid to senior level developer. For
information or to apply e-mail resume to
sam_blinex_com.
 
Samuel R. Neff said:
If they're running on the same computer why use web services? Use
something more efficient like remoting or named pipes, both of which
offer two-way communications.

Because the WinForm isn't the client of the webservice.

If you follow the OP, some (apparently) external process calls the
webservice, and the WS needs to call the WinForm for something.
 
I don't see where the OP says the form is not the client.. the post
implies that the form is in fact the client.

In any case, if the form is not the client then the code behind the
web service can still communicate with the form through remoting or
named pipes or some other local communication method and provide a web
service interface for external calls.

Sam


Because the WinForm isn't the client of the webservice.

If you follow the OP, some (apparently) external process calls the
webservice, and the WS needs to call the WinForm for something.

B-Line is now hiring one Washington D.C. area VB.NET
developer for WinForms + WebServices position.
Seaking mid to senior level developer. For
information or to apply e-mail resume to
sam_blinex_com.
 
If they're running on the same computer why use web services? Use
something more efficient like remoting or named pipes, both of which
offer two-way communications.

Sam

Thanks m8, i used Named Pibes, and it worked, I can see the prob of making
events in a webservice. The webservice then would need to have some kind of
connection to the client, which I presume it doesnt havent.

But anyway, the named pibes is a good solution for my problem.

Richard
 
Back
Top