Internet Technologies and Web Application Web Services With ASP.NET Tutorial: Introduction to.

Slides:



Advertisements
Similar presentations
1 After completing this lesson, you will be able to: Search for information on the Web. Create a favorites list. Use and modify your History folder.
Advertisements

Introduction to MVC Adding a View Page NTPCUG Tom Perkins, Ph.D.
11 Getting Started with ASP.NET Beginning ASP.NET 4.0 in C# 2010 Chapters 5 and 6.
Microsoft Office 2007 Microsoft Excel Collaboration Feature Using SharePoint and Excel Services.
Web Forms and ASP.NET Programming Right from the Start with Visual Basic.NET 1/e 12.
Chapter 12: ADO.NET and ASP.NET Programming with Microsoft Visual Basic.NET, Second Edition.
1 Static Web Pages Websites on Servers (The Big Picture) –Apache Tomcat can support static web pages –Primarily intended to support servlets and JSP –Some.
Introduction to Web Application Development with.Net and Web Service ISYS 350.
Student iDrive Access ESU Website Server Storage Space.
Creating web service (and client application) with Visual Studio 2008 Create web service project New project->web->ASP.NET web service application (with.
Browser and Basics Tutorial 1. Learn about Web browser software and Web pages The Web is a collection of files that reside on computers, called.
Computer Science 101 Web Access to Databases Overview of Web Access to Databases.
Agenda – Week 5, Day 2 Complete RoboHelp Tutorial Transition to HTML Tutorial –Warm-up – Explore HTML –Page Design – Create a page –Publishing – Make your.
1 Web Services Visual C# 2008 Step by Step Chapter 30.
An Introduction to ASP.NET Web Pages 2 Module 1: Webmatrix Installation and Your First Web Site Tom Perkins.
11 ASP.NET Controls Beginning ASP.NET 4.0 in C# 2010 Chapter 6.
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
2. Introduction to the Visual Studio.NET IDE 2. Introduction to the Visual Studio.NET IDE Ch2 – Deitel’s Book.
Joe Hummel, PhD Dept of Mathematics and Computer Science Lake Forest College Lecture 8: WebForms — Web-based.
Internet. Internet is Is a Global network Computers connected together all over that world. Grew out of American military.
ASP.Net, Web Forms and Web Controls 1 Outline Introduction Simple HTTP Transaction System Architecture Creating and Running a Simple Web Form Example Web.
Chapter 9 Web Applications Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
Introduction to.Net and ASP.Net Course Introduction Build Your Own ASP.Net Website: Chapter 1 Microsoft ASP.Net Walkthrough: Creating a Basic Web Forms.
9-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
Tutorial: Introduction to ASP.NET Internet Technologies and Web Application 4 th February 2010.
JavaScript & jQuery the missing manual Chapter 11
HTML, GUI, ASP.NET Rina Zviel-Girshin Lecture 2
Joe Hummel, PhD Dept of Mathematics and Computer Science Lake Forest College
Beginning Web Site Development Module 1 – Dynamic Web Site Development Fundamentals of building dynamic Web sites with ASP.NET 2.0 and C# Version.
Programming with Microsoft Visual Basic 2012 Chapter 12: Web Applications.
Creating Web Applications Using ASP.NET Chapter Microsoft Visual Basic.NET: Reloaded 1.
E-Commerce: Introduction to Web Development 1 Dr. Lawrence West, Management Dept., University of Central Florida Topics What is a Web.
Web Programming: Client/Server Applications Server sends the web pages to the client. –built into Visual Studio for development purposes Client displays.
HOW WEB SERVER WORKS? By- PUSHPENDU MONDAL RAJAT CHAUHAN RAHUL YADAV RANJIT MEENA RAHUL TYAGI.
11 Web Services. 22 Objectives You will be able to Say what a web service is. Write and deploy a simple web service. Test a simple web service. Write.
CSCI 6962: Server-side Design and Programming Introduction to Active Server Pages.
McGraw-Hill © 2009 The McGraw-Hill Companies, Inc. All rights reserved. Programming with Visual Web Developer Chapter 9.
C# Tutorial -1 ASP.NET Web Application with Visual Studio 2005.
Working with GridView Control: Adding Columns. Adding Buttons to a Bound GridView: 1. Drag the WebProduct table from Data connection to a page 2. Demo.
© Chinese University, CSE Dept. Distributed Systems / Simple Example Open Microsoft Visual Studio 2005:
1 Chapter 12 – Web Applications 12.1 Programming for the Web, Part I 12.2 Programming for the Web, Part II 12.3 Using Databases in Web Programs.
ASP.NET The Clock Project. The ASP.NET Clock Project The ASP.NET Clock Project is the topic of Chapter 23. By completing the clock project, you will learn.
1 Project 3: Chomp (Not graded). 2 Project 3 The game of Chomp was described in a Math Trek column in Science News:
1 After completing this lesson, you will be able to: Transfer your files to the Internet. Choose a method for posting your Web pages. Use Microsoft’s My.
Global.asax file. Agenda What is Global.asax file How to add the Global.asax file What are the default events available Explanation to Application_Level.
Dynamic Dropdown Lists 1. Objectives You will be able to Use Dropdown Lists to solicit multiple choice user input in an ASPX web page. Populate a Dropdown.
XML Web Service. Overview of XML Web Service ASP.NET XML Web services enable you to remotely access the properties and methods of classes across a network.
Web Development in Microsoft Visual Studio Slide 2 Lecture Overview How to create a first ASP.NET application.
Introduction to Web Services. Examples Using a Web Service Creating a new Web Service.
The Module Road Map Assignment 1 Road Map We will look at… Internet / World Wide Web Aspects of their operation The role of clients and servers ASPX.
Week Six : Writing Web Services Aims: Creating and Consuming student’s first Web Services Learning Outcomes: Familiarity with VS.NET for creating and consuming.
IMS 4480: Introduction to Web Services 1 Dr. Lawrence West, MIS Dept., University of Central Florida Introduction to Web Services—Topics.
Module 9: Using XML Web Services in a C# Application.
Module 4: Creating a Web Application with Web Forms
1 After completing this lesson, you will be able to: Get around the Internet with your browser. Connect to the Internet. Print Web pages. Save Web pages.
11 Getting Started with ASP.NET Beginning ASP.NET in C# and VB Chapters 1 and 2.
1 Project 4 Address Lookup. Project 4 Write an ASP.NET app that permits users to retrieve addresses from a potentially large list of addresses. There.
11 User Controls Beginning ASP.NET in C# and VB Chapter 8.
Creating a Web Site Creating a new Web site Defining and using folders Creating and editing Web pages Viewing pages in a Web browser.
XP New Perspectives on Creating Web Pages With Word Tutorial 1 1 Creating Web Pages With Word Tutorial 1.
111 State Management Beginning ASP.NET in C# and VB Chapter 4 Pages
1 Using MVC 6. MVC vs. ASP Web Forms Both run under ASP.NET Can coexist In Web Forms, browser requests page. xxx.aspx and xxx.aspx.cs on the server Page.
Computing with C# and the .NET Framework
ASP.NET Forms.
Part 1 of 2 Creating SQL Database and Binding to GridView
How to Create a Simple Web Service and Use it in ASP.Net
ASP.NET.
Web Form Introduction.
5/6/2019 Session 8.2 Postback, ViewState
Presentation transcript:

Internet Technologies and Web Application Web Services With ASP.NET Tutorial: Introduction to

Lesson 1: Creating a Web Service

Lesson 1 – Creating a Web Service  Exercise 1.1 – Create and understand a web service  Web Service is objects and methods that can be invoked from any client over HTTP.  In this exercise, you will create a simple Web service with “Hello World” method using Visual Studio.NET.  You will test the Web service through its associated documentation web page.

1. Launch Microsoft Visual Studio.NET Create new website, choose Visual C#, select location as HTTP and enter site location as then click OK. Lesson 1 – Creating a Web Service

3. Create new web service, click WebSite ->Add New Item… 4. Select Web Service icon and enter file name as WebService.asmx, then click Add button. 5. The default page of web service class will be created. Lesson 1 – Creating a Web Service

1) ASP.NET web service class - kept in App_Code Folder only, used to create web methods 2) “WebService.asmx” file – let the client call web methods 3) “HelloWorld” method – default method in web service class Lesson 1 – Creating a Web Service

6. Test the web service, right click on WebService.asmx in solution explorer, then click Set As Start Page, press F5 to run the solution (start debugging). 7. Internet Explorer will start and display a documentation page for the web service as seen in the following illustration. Lesson 1 – Creating a Web Service

8. Click “HelloWorld” method to test the operation using the HTTP POST protocol, then click the Invoke button. 9. You will see a resulting XML page that contains the result of the “HelloWorld” method as seen in the following illustration. Lesson 1 – Creating a Web Service

Lesson 2: Passing Parameters and Returning Values in Web Service

 Exercise 2.1 – Create a web method with parameter passing and returning values  In this exercise, you will create a new web method “HelloUser” which will get the parameter passed from web page and return back the string value.  You will test the Web service through its associated documentation web page. Lesson 2 – Passing Parameters and Returning Values in Web Service

1. Create new web method “ HelloUser ”. [WebMethod] public string HelloUser(string yourName) { return "Hello,"+ yourName; } 2. Press F5 to run the solution. 3. Test the Web service method in browser. To test the method, click on the link for the method name “ HelloUser ”, type your name in the text box and then click Invoke button to view the result. Lesson 2 – Passing Parameters and Returning Values in Web Service

Lesson 3: Adding a Web Reference

 Exercise 3.1 – Add a web reference to the web service  Web reference is proxy class created on the client to connect to the web service running on the server.  In this exercise, you will learn how to add a web reference to the web service. Lesson 3 – Adding a Web Reference

1. Click WebSite->Add web Reference.. 2. On Add Web Reference window  Enter URL Web Service: WebService.asmx  Host Name: IP Address or domain Web Service  Enter your Web Reference name: WebReference  Click Add Reference button Lesson 3 – Adding a Web Reference

3. Result in solution explorer. Lesson 3 – Adding a Web Reference

Lesson 4: Calling a Web Service via Web Application

 Exercise 4.1 – Call a web service via web application  In this exercise, you will create an ASP.NET web page that uses the web service you created in lesson 2.  You will test the web service client that will pass the parameter to the web service. Lesson 4 – Calling a Web Service via Web Application

1. Open “ Default.aspx ” page, then add textbox, button, and label in the design view.  Textbox ID: yourName  Button ID: callService  Label ID: valueReturn Lesson 4 – Calling a Web Service via Web Application

2. Create method “ callService_Click” for “callService ” button. protected void callService_Click(object sender, EventArgs e) { //Create new object of web reference for call web servic e WebReference.WebService callResult = new WebReference.WebService(); //Call method HelloUser and pass parameter to method //Method HelloUser returns result to label control valueReturn.Text = callResult.HelloUser(yourName.Text); } Lesson 4 – Calling a Web Service via Web Application

3. Press F5 to run the solution. 4. Test the application in browser. Enter your name in textbox and click Result button. Lesson 4 – Calling a Web Service via Web Application

Lesson 5: Modifying a Web Service

 Exercise 5.1 – Modify web service by adding more web methods  In this exercise, you will add 2 web methods to your existing web service class.  “getQuestionList” method will return the arrayList for binding to dropDownList.  “checkAnswer” method will get the selected index from dropDownList as a parameter and return the answer in string format. Lesson 5 – Modifying a Web Service

1. Create new web methods “ getQuestionList ” and “ checkAnswer ” in WebService class. [WebMethod] public ArrayList getQuestionList() { ArrayList list = new ArrayList(); list.Add("Select Question"); list.Add("What is your name?"); list.Add("What is your student ID?"); return list; } Lesson 5 – Modifying a Web Service

[WebMethod] public string checkAnswer(int questionIndex) { string answer; switch (questionIndex) { case 0: answer = "Select Question"; break; case 1: answer = "My name is Enter Name "; break; Lesson 5 – Modifying a Web Service

case 2: answer = "My Student ID : Student ID Number "; break; default: answer = "Select Question"; break; } return answer; } Lesson 5 – Modifying a Web Service

2. In solution explorer, update web reference by right clicking at App_WebReferences folder and click Update Web\Service. 3. Add dropDownList and Label to web page (Default.aspx) in design view.  dropDownList ID: List Question  dropDownList AutoPostBack: True  Label ID: AnswerValue Lesson 5 – Modifying a Web Service

3. Add code in code-behind (default.aspx.cs) protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { WebReference.WebService getDataSource; getDataSource = new WebReference.WebService(); ListQuestion.DataSource = getDataSource.getQuestionList(); ListQuestion.DataBind(); } Lesson 5 – Modifying a Web Service

protected void ListQuestion_SelectedIndexChanged(object sender, EventArgs e) { WebReference.WebService getAnswer; getAnswer = new WebReference.WebService(); AnswerValue.Text = getAnswer.checkAnswer(ListQuestion.SelectedIndex); } Lesson 5 – Modifying a Web Service

4. Run and test the result in browser. Lesson 5 – Modifying a Web Service

Lesson 6: Web Services in Real Application

 Exercise 6.1 – Call a web service from another machine and display in gridView.  In this exercise, you will learn to call web service from server and display the result in gridView in the form of table. Lesson 6 – Web Service in Real Application

1. Add web reference  URL: mx  Web reference name: CustomerUpdate 2. Create new ASP.NET web form “ Customer.aspx ” in design page. Add textbox, button, and gridView.  Textbox ID: customerName  Button ID: saveCustomer  GridView ID: viewCustomer  GridView Set AutoFormat: Classic Lesson 6 – Web Service in Real Application

2. Create new ASP.NET web form “ Customer.aspx ” in design page. Add textbox, button, and gridView.  Textbox ID: customerName  Button ID: saveCustomer  GridView ID: viewCustomer  GridView Set AutoFormat: Classic Lesson 6 – Web Service in Real Application

3. Add code in code-behind (default.aspx.cs) protected void loadCustomer() { CustomerUpdate.Service cus = new CustomerUpdate.Service(); viewCustomer.DataSource = cus.viewCustomer(); viewCustomer.DataBind(); } protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack){ loadCustomer(); } Lesson 6 – Web Service in Real Application

protected void saveCustomer_Click(object sender, EventArgs e) { CustomerUpdate.Service cus = new CustomerUpdate.Service(); int result = cus.updateCustomer(CustomerName.Text, "Your Student ID"); if (result == 1) { loadCustomer(); } else { Response.Write("Insert faile !"); } Lesson 6 – Web Service in Real Application

3. Run and test in browser Lesson 6 – Web Service in Real Application

Internet Technologies and Web Application