howto modify a label's/textboxe's value that is a membr of a form in the windows applicati

i want to ask "how to modify a label's/textboxe's value that is a member of a form in the windows application project from a web service project?"

In my solution there are three projects! one of them is ASP.NET web service, other is classLibrary and another is a windows application... (build order 1.win app, 2.classLib,3.WebServ). firstly i create then show a login form(name: loginForm) that is in my win app project. then when user logins to the system and a form(name: userForm) opens that is in classLibrary project! and now that is important! when any client that is using my web service calls a method of the web service i want to show the value of the web method's parameter in one of the my userForm's controlles(for ex: label or textbox)... but i can not show this value!!! help me!

Note: i'm sorry for my english:( if i can't explain what i want to do i can explain again)

[895 byte] By [Selim] at [2008-1-27]
# 1
The web service will be running server-side eventually (I assume) and the code in that project will be unable to access anything in the WinForms app. You have two main options:
  1. Modify the generated web service proxy code. Show all files in the Solution Explorer and expand Web References... YourWebServiceName... You should see a .cs or .vb file depending on the implementation language of your WinForms app. N.B. You will lose any customizations if you have to regenerate the proxy. For instance, if you add a method or change a parameter/return value from one of your methods.
  2. Create an adapter class. The adapter simply mirrors the methods on your web service (and your proxy for that matter) and simply calls the proxy (which is what you are in fact doing when you're calling the web service from your WinForms or class lib code). The advantage here is that you don't lose your customizations when you regenerate the proxy.
Hope that helps.
JamesKovacs at 2007-8-21 > top of Msdn Tech,.NET Development,ASMX Web Services and XML Serialization...
# 2
firstly thanks for answer! but i'v realized that i couldn't describe my problem. i m sorry:( for ex: you said "which is what you are in fact doing when you're calling the web service from your WinForms or class lib code" but i don't call web service from my win app. or classLib. they are all running in same virtual machine! these are all the server(administrative) side of the my whole project. there are some clients that are developed with java by other members of the project team and they are independent from me! if one of these java clients calls the my web service method with a parameter, i want to show this value (or formatted value) in windows forms in the server side. windows forms are in my classLib project... lastly (again) this is my solution --> 1. windows application project, 2. classLib project, 3.ASP.NET web service porject... these are all in the same PC also in same VirtualMachine! clients that are call my web methods are in different location and developed with java... i hope i can explain my problem at this time!..

thanks...

Selim at 2007-8-21 > top of Msdn Tech,.NET Development,ASMX Web Services and XML Serialization...
# 3
No problem about the language barrier. I believe I understand what you're trying to do now. Your web service exists in a different process than where your WinForm/ClassLib are running. You need to find a way to transmit messages between them and you have a few ways of doing that. Since they're in different processes, you can't reference any Label or TextBox controls in the ClassLib as the memory references are only valid within an AppDomain (and hence process). You have a few choices to connect the apps:
  1. Database
  2. Shared file
  3. Message queue
  4. TCP Port
  5. .NET Remoting
All these techniques involve creating a common location for communication. Your Web Service writes in trace information (such as method parameters) and your WinForm reads it back in. The code to read the data and then update the Label/TextBox controls exists in the ClassLib and would have access to the Label/TextBox controls. With a database, your app would have to poll for changes, which isn't an ideal situation. With a file, you could use the FileSystemWatcher class to monitor for changes from the ClassLib. With a message queue (look at the System.Messenging namespace), you could attach a listener that would respond when new messages arrive. With a TCP Port, you would use a TcpListener, but the technique is the same.

.NET Remoting works in much the same way, but is at a higher level of abstraction. You create an object derived from MarshalByRefObject, which you then expose via a TCP or SOAP channel. (I would recommend TCP for your case.) This object would exist in your ClassLib and receive instructions from the Web Service to update the Label/TextBox.

If this were a year or two in the future, I would be recommending Indigo rather than .NET Remoting, but .NET Remoting is what we have in our current toolbelt.

I hope that helps.

JamesKovacs at 2007-8-21 > top of Msdn Tech,.NET Development,ASMX Web Services and XML Serialization...
# 4
thank you very much for your all opinions! but absolutely i can't describe my problem openly!.. now i m explaining my problem with an example..

now suppose msn messenger has a web service at the background. all msn clients have web servers in their computers and web services on web servers... like real world, when a person who is in your contact list sends a message to you, a window opens on your screen... that's OK! i mean when you send message to me you call my web service's "receive message" method. and this method calls a method for showing this message in a window on my screen. but i can not show this message in a form on the screen. this is very similiar to my problem!.. i think any remoting or port solution isn't necessary! Becuase like i wrote before, all my problems are on server side! All my applications and web services are running on the same machine. remember "suppose msn messenger has a web service at the background"! suppose all msn clients have web services on their computers!..

Thanks...

Selim at 2007-8-21 > top of Msdn Tech,.NET Development,ASMX Web Services and XML Serialization...
# 5

In the MSN Messenger example, I would host the web service in the same app domain as the WinForms app. You can't do this easily using ASMX Web Services, but it's quite straightforward with WSE 2.0. (It will also be possible with Indigo when it debuts.) You can find a list of articles on WSE here to get you started. One concern with this architecture (which might not be a concern for you depending on the actual application) is that you would need your UI running in order to receive web service calls. In the MSN Messenger case, it isn't a problem because you don't want to receive messages when the application isn't running. This might be the case with your app. The other problem doesn't have anything to do with where you host your web services. It's more a problem with network topology. If you're writing a messenger-type application, typically users will be behind firewalls and you can't make a direct point-to-point connection between the two applications. That's why messenger-style applications typically connect through a known 3rd-party (e.g. MSN Messenger Server) rather than going truly peer-to-peer. So think about your planned deployment environment because what might work locally on your network might fail miserably in the real world. Skype, MSN Messenger, and various peer-to-peer frameworks have spent a great deal of effort trying to overcome issues around firewalls, NATs, proxies, etc. Just make sure you do your homework.

JamesKovacs at 2007-8-21 > top of Msdn Tech,.NET Development,ASMX Web Services and XML Serialization...

.NET Development

Site Classified