Tutorials
ASP.NET
Creating and consuming XML Web Services with C#
Creating and consuming XML Web Services with C# - Page 2
Let's make a Console application which consumes this service. You can use any language and platform to consume this service, that's the purpose of XML WebService. Now, this procedure requires some mouse clicking :). So I will write down the steps instead of pasting the screen shots.
Now, all you have to do is to make the instance of the WebService class using the reference name that you provided, which is "MyService".
using System;
namespace MyClient
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
// Make an instance of the WebService Class
// using the Web Reference you provided
MyService.Service1 service = new MyService.Service1();
// Assign message what ever is returned
// from HelloWorld in this case "HelloWorld"
string message = service.HelloWorld();
// Prints out the message on the screen
Console.WriteLine(message);
}
}
}
And that's it. You use the webservice class just like any other class. Something you need to keep in mind is that if you decide to make a new method in your webservice and want to make it available to the client, then always remember to build your webservice solution so that the assembly can be updated. If you don't build your webservice, you won't be able to see the methods on the client side.
A consumer is the one who uses the service and a provider is the one who provides the service. Http clients can be an asp.net application or any other application that communicates with the web service through internet.
As I said previously that Web Services are used to communicate between different systems. These systems can be writting different operating systems but their communication medium is xml which they all can understand. These legacy systems can be COBOL, FORTON and PASCAL. So instead of making a complete new application in Asp.net Web Service can be used to link different systems together.
First Page: Creating and consuming XML Web Services with C#
| very helpful |
| worked like a jump starter. ver very helful |
| Good to start with! |
| Very Very good introduction to webservices. I have read a lot of complex articles that make it too boring to learn about webservices, They just make the reader irritated . You have given a simple programme to create and consume webservices. Excellent ! simply Excellent!! |
|
This article is a very good starter. I was searching the Web for a good article on Web Services because i could not understand what they are speaking? After reading this article I have a got a very good idea about WebService. Thanks to Exforsys and author of this article for explaining WebServices in a simple and sweet manner. Excellent article!!! |