Simple console application demonstrating how to execute a Web service via C#.
using System; namespace CSharpWSClient { /// <summary> /// A simple console application that demonstrates how to execute a web /// service via C#. This was done by adding a Web Reference /// (http://localhost/Test/Test.asmx?WSDL) to the Visual Studio /// .NET project. In this case a .NET WSDL was used. The code may be /// slightly different for other web service platforms and WSDL formats. /// </summary> class Class1 { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main(string[] args) { try { //Instantiate the service localhost.TestService service = new localhost.TestService(); //Set the task inputs localhost.TaskScreenInputs inputs = new localhost.TaskScreenInputs(); inputs.Input = "data"; //Execute the task localhost.TaskScreenOutputs outputs = service.Task(inputs); //Display the output System.Console.Out.WriteLine(outputs.Output); } catch (Exception xx) { System.Console.Error.WriteLine(xx.ToString()); } } } }
![]() |
|
![]() |
Using Tasks in Your Applications, Overview |
![]() |
Building Applications Using Native Win32 Technologies |
![]() |
Building Web Services Using .NET, Overview |
![]() |