• 0

[Reg]Creating WebService & consume in windows application


Question

Hi Guys,

I am doing a small project with my friend.

What we plan to do is following

1. My friends desktop would act as an server which runs a web service

2. This service connects to its database and query for some data whenever some events occurs

3. my pc runs a window application. The windows application contains a login page... so whenever user fills the login page the details should be forwarded to the web-service which would inturn connects to the database.

4. When some event occurs the server side application sends a data-set to the webservice

4. The webservice sends the data (in data-set format) to the windows application (on my computer) which consumes to create a tree view

I have created a webservice and a windows taskbar application on my pc and also i am able to make the application to consume webmethods of webservice

But how do i send the data from application(on my pc ) to webservice, and that information from webservice to server and viceversa :blink:

Can anyone suggest me how to do it??? :cry:

Ny help wuld be definitely appreciated :)

Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0

i guess both computers will need to constantly poll for new information.

computer 1 sends the information to the webservice.

the webservice stores this information in the database.

computer 2 polls for new information, if it finds something it sends a request to the webservice for that information.

information is removed from the database.

computer 1 and 2 continue to poll for updates at regular intervals.

I'm still not sure what you are trying to do though...

If you are just wondering how to build a webmethod to handle data-sets then let me know.

Link to comment
Share on other sites

  • 0
i guess both computers will need to constantly poll for new information.

computer 1 sends the information to the webservice.

the webservice stores this information in the database.

computer 2 polls for new information, if it finds something it sends a request to the webservice for that information.

information is removed from the database.

computer 1 and 2 continue to poll for updates at regular intervals.

Thank you, Quigley!!! :)

guess you have said is correct, I would like to do exactly the same

The reason I am doing this is to integrate two different systems.Both the systems are independent of each other.

Now this webservice would continuously look for updated information in the database(system1). If so it would pull and send to windows application(residing on client) a dataset.

Depending upon the data in the dataset which would be hierrachial data, tree view(with check box) would be formed.

The user would check from the treeview and click on submit. The checked item would be send back to the webservice and webservice would send to the database(system2) to update.

I am able to create a windows application that runs continuously on system tray, but how dont know how to make him continuously question the webservice and viceversa. :(

I am attaching my project and also the webservice.

Any help would be appreciated :)

SampleWindowsApplication.zip

Link to comment
Share on other sites

  • 0

There are a couple of ways you could do these, all essentially use threading. This could be done with a Timer, the BackgroundWorker type, or simply using the Thread type directly. This is probably your first port of call. You need to poll the web service every few minutes or so, check for new information. If data exists, pull it down from the service.

As for your service technology, ASP.NET Web Services will do the trick, but if you then want to push that data running locally on your machine, there is also a variety of things that can be done there, from writing a file, pushing to a database, interprocess communication, WCF servers and clients.

Thats what I love about .NET, there are so many ways to do things!

Link to comment
Share on other sites

  • 0
There are a couple of ways you could do these, all essentially use threading. This could be done with a Timer, the BackgroundWorker type, or simply using the Thread type directly. This is probably your first port of call. You need to poll the web service every few minutes or so, check for new information. If data exists, pull it down from the service.

As for your service technology, ASP.NET Web Services will do the trick, but if you then want to push that data running locally on your machine, there is also a variety of things that can be done there, from writing a file, pushing to a database, interprocess communication, WCF servers and clients.

Thats what I love about .NET, there are so many ways to do things!

If you can explain me using some example... that would be gud. I have attached my project for everyone refrence, wuld be greate if u can throw more light with it!!!

Appreciate your help :)

Link to comment
Share on other sites

  • 0
I am able to create a windows application that runs continuously on system tray, but how dont know how to make him continuously question the webservice and viceversa. :(

Creating a timer will allow you to call a method at set intervals.

The following code will run the updateTimer_Tick method every two seconds (2000 ms) when the timer elapses.

Now you'll need a "checkForUpdates" and an "updateDataset" webmethod for your webservice.

private Timer updateTimer = null;

private void frmWindowsApplication_Load(object sender, EventArgs e)
{
		this.updateTimer = new Timer();

		this.updateTimer.Interval = 2000;
		this.updateTimer.Tick += new EventHandler(updateTimer_Tick);
		this.updateTimer.Start();
}

private void updateTimer_Tick(object sender, EventArgs e)
{
		// check for updates in this method
		MessageBox.Show("Checking...");
}

Hope this helps get you a bit further with your project.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.