473,396 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

call from a webservice to a windows Form

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.
Nov 17 '05 #1
5 2276
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.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Richard Kure" <None> wrote in message
news:42***********************@dreader2.cybercity. dk...
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.

Nov 17 '05 #2

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
On Mon, 11 Apr 2005 14:58:13 +0200, "Richard Kure" <None> wrote:
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.
Nov 17 '05 #3
"Samuel R. Neff" <bl****@newsgroup.nospam> wrote in message
news:r2********************************@4ax.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.


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.
Nov 17 '05 #4

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
On Mon, 11 Apr 2005 11:12:24 -0400, "James Curran"
<ja*********@mvps.org> wrote:
"Samuel R. Neff" <bl****@newsgroup.nospam> wrote in message
news:r2********************************@4ax.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.


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.
Nov 17 '05 #5
> 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
Nov 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Clint | last post by:
Hey all - I'm having a really confusing problem concerning a web service. Right now, I have an application that needs to call a web service that does nothing but return "true" (this will...
2
by: elora_c | last post by:
I'm making a call to a webservice from my ASP.NET page. The web application has anonymous access turned off and Integrated Windows auth turned on. The web.config has <identity impersonate=true>. ...
4
by: Tim Gallivan | last post by:
Hello group, I'm trying to develop a proof of concept webservice which asynchronously calls a function in a DLL. The function raises an event when it is finished, and works when used as part of...
2
by: Lorenzo | last post by:
I have a .net webservice (located in a different machine) that is called twice from a windows form .net application. The ws works fine if I called only one call, but failed if I called them...
15
by: Alpha | last post by:
I was told that Unix API can only be called using C++, ATL and MFC. However, I was also told that C# can do that through Pinvoke to a DLL that interfaces with the Unix API. Can someone direct me...
0
by: Rene Ruppert | last post by:
Hi, On the web I found a simple sample/tutorial for a webservice, some kind of chat software. I implemented the server and the client. When I run the client form on the host PC everything works...
1
by: Mr Bojangles | last post by:
Hi, I want a do the following: From a (client side) web form, post to server side script (I'm using Javascript but anything will do), which in turn--and this is the important bit that I...
6
by: plork | last post by:
hi all i'm calling a web service method and can get it's results just fine however i want to grab the repsonse message from the call is anyone able to tell me how i do this? results =...
3
by: James | last post by:
Hi, I have built a windows app that makes calls to a webservice. Both webservice and windows apps are built with .net 2.0. The problem is... when I run the client Windows app on the dev machine,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.