Download presentation
Presentation is loading. Please wait.
1
Creating web service (and client application) with Visual Studio 2008 Create web service project New project->web->ASP.NET web service application (with desired programming language ) Create needed functions [WebMethod] public decimal Add(decimal a, decimal b) { return a + b; } Test on browser (ASP.NET development server creates simple UI to test web service functions)
2
Create client project – New project->Windows->Windows forms application (or some other project type) – Check - Solution: add to solution Create user interface for testing the add service (Toolbox) – Three textboxes (a,b and result) – A button for calling the service – Needed labels
3
Reference the service – In solution explorer – add service reference on application. Advanced->Add web reference-> Web services in this solution – Select service and add reference – Now you can call the web service functions (first create a new proxy-object) – Visual studio added a proxy class (Reference.cs) to project (under web references folder) along with disco and wsdl files
4
Call the add function after button click private void button1_Click(object sender, EventArgs e) { testservice.Service1 serv= new testservice.Service1(); resultBox.Text = (serv.Add(Convert.ToDecimal(aBox.Text), Convert.ToDecimal(bBox.Text))).ToString(); } Run the application
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.