Upload
pabburahati
View
222
Download
0
Embed Size (px)
Citation preview
7/30/2019 Topik 5.1 Understand Web Forms
1/41
F5227VISUAL BASIC .NET PROGRAMMING
Topic 5.0:
WEB FORMS AND XML WEB SERVICES
7/30/2019 Topik 5.1 Understand Web Forms
2/41
Course Learning Outcome (CLO) Upon completion of this course, students should be able to :
1. Create a simple VB.NET based application based on the
Windows Application template.
2. Describe on essential terminology including memory,data types and graphical user interface.
3. Apply object oriented programming techniques to
create classes, add methods and add properties.
4. create a simple VB.NET
based Web forms applicationthat uses an XML Web Service and manipulate data in
database by using Microsoft ADO.NET.
7/30/2019 Topik 5.1 Understand Web Forms
3/41
Course Learning Outcome:
Topic 5.0
1. create a simple VB.NET based Web forms application
that uses an XML Web Service and manipulate data in
database by using Microsoft ADO.NET
7/30/2019 Topik 5.1 Understand Web Forms
4/41
Topic 5.0
Topic 5.1 : Understand with Web Forms
Topic 5.2 Create a web application using
VB.NET
Topic 5.3 : Work with Data using ADO.NET
7/30/2019 Topik 5.1 Understand Web Forms
5/41
Topic 5.1
Understand with Web Forms (XML and Web
Services)
7/30/2019 Topik 5.1 Understand Web Forms
6/41
Introduction
Web Forms are based on ASP.NET.
Working with Web Forms is similar to working
with Windows Forms.
But the difference is that we will create Web
pages with Web forms that will be accessible
by a Web browser.
7/30/2019 Topik 5.1 Understand Web Forms
7/41
Web Forms are Web pages that serve as the
user interface for a Web application.
A Web Forms page presents information to
the user in any browser or client device and
implements application logic using server-side
code.
7/30/2019 Topik 5.1 Understand Web Forms
8/41
Web Forms Hierarchy
Web Forms are based on
the System.Web.UI.Page class.
The class hierarchy for the page class is shown
below.
Object
Control
TemplateControl
Page
7/30/2019 Topik 5.1 Understand Web Forms
9/41
Components of Web Forms
In Web Forms pages, the user interface
programming is divided into two parts:
the visual component (design page)
the logic (code behind page).
7/30/2019 Topik 5.1 Understand Web Forms
10/41
The visual element is the Web Forms page.
The page consists of a file with static HTML, or
ASP.NET server controls, or both
simultaneously.
The Web Forms page works as a container for
the static text and the controls we want to
display.
7/30/2019 Topik 5.1 Understand Web Forms
11/41
Using the Visual Studio Web Forms Designer
and ASP.NET server controls, we can design
the form just like in any Visual Studio
application.
7/30/2019 Topik 5.1 Understand Web Forms
12/41
The Files
The logic for the Web Forms page consists of
code that we create to interact with the form.
The programming logic is in a separate file
from the user interface file.
This file is the "code-behind" file and has an
".aspx.vb" (VB) or ".aspx.cs" (C-Sharp)
extension.
The logic we write in the code-behind file can
be written in Visual Basic or Visual C#.
7/30/2019 Topik 5.1 Understand Web Forms
13/41
The code-behind class files for all Web Forms
pages in a project are compiled into the
project dynamic-link library (.dll) file.
The .aspx page file is also compiled, but
differently.
The first time a user loads the aspx page,
ASP.NET automatically generates a .NET class
file that represents the page, and compiles it
to a second .dll file.
7/30/2019 Topik 5.1 Understand Web Forms
14/41
The generated class for the aspx page inherits
from the code-behind class that was compiled
into the project .dll file.
When the user requests the Web page URL,
the .dll files run on the server and dynamically
produces the HTML output for your page.
7/30/2019 Topik 5.1 Understand Web Forms
15/41
Web Forms
7/30/2019 Topik 5.1 Understand Web Forms
16/41
.aspx file
The form opens in design mode and you can
switch to HTML view by clicking on the HTML
tab.
Startvbdotnet.aspx file in the image is
standard HTML with ASP elements embedded
in it
7/30/2019 Topik 5.1 Understand Web Forms
17/41
.aspx file
The codebehind attributeconnects this code to the
appropriate Visual Basic or
C# code (code behind file)
7/30/2019 Topik 5.1 Understand Web Forms
18/41
Code BehindPublic Class Startvbdotnet Inherits System.Web.UI.Page
Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs)_
Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)_
Handles MyBase.Load
'Put user code to initialize the page here
End Sub
End Class
7/30/2019 Topik 5.1 Understand Web Forms
19/41
The ASPX Extension
Many of us wonder why the extension for
ASP.NET is .aspx.
Well, long time ago, when ASP.NET was being
developed at Microsoft it was referred to as
ASP+ (ASP Plus).
7/30/2019 Topik 5.1 Understand Web Forms
20/41
You can't use a "+" symbol in a filename but if
you turn the + symbol about 45 degrees, it
looks like a x. Microsoft chose .aspx as the
extension of ASP+.
After the name was changed to ASP.NET,
Microsoft did'nt change the extension and left
it as aspx.
7/30/2019 Topik 5.1 Understand Web Forms
21/41
7/30/2019 Topik 5.1 Understand Web Forms
22/41
What is Web Service
The term "web service" refers to a form of a
component that can be used remotely.
Microsoft offers two types of web services in
their .NET framework:
XML web services
.NET remoting.
When developers refer to web services they
usually mean XML web services
http://www.developerfusion.com/t/.net/http://www.developerfusion.com/t/xml/http://www.developerfusion.com/t/xml/http://www.developerfusion.com/t/.net/7/30/2019 Topik 5.1 Understand Web Forms
23/41
Web Service
7/30/2019 Topik 5.1 Understand Web Forms
24/41
XML Web Services
Web services are invoked remotely using
SOAP or HTTP-GET and HTTP-POST protocols.
Web services are based on XML and return an
"answer" to the client in XML format.
Web services have all the advantages of
components plus many more.
7/30/2019 Topik 5.1 Understand Web Forms
25/41
Advantages of XML Web Services
Language and platform independence:
Web services can be built and consumed on
any operating system just as long as that
operating system supports the SOAP protocol
and XML.
7/30/2019 Topik 5.1 Understand Web Forms
26/41
XML
XML files are plain text files just like HTML
files.
XML can easily be stored and generated by a
standard web server.
7/30/2019 Topik 5.1 Understand Web Forms
27/41
Generating XML with ASP
XML can be generated on a server without any
installed XML software.
To generate an XML response from the server
- simply write the following code and save it as
an ASP file on the web server:
7/30/2019 Topik 5.1 Understand Web Forms
28/41
XML in ASP
Note that the content type of the response
must be set to "text/xml".
7/30/2019 Topik 5.1 Understand Web Forms
29/41
Web Services
Web Services can convert your application
into a Web-application, which can publish its
function or message to the rest of the world.
The basic Web Services platform is XML +
HTTP.
7/30/2019 Topik 5.1 Understand Web Forms
30/41
What are Web Services
Web services are application components
Web services communicate using open
protocols
Web services are self-contained and self-
describing
Web services can be discovered using UDDI
Web services can be used by other
applications
XML is the basis for Web services
7/30/2019 Topik 5.1 Understand Web Forms
31/41
How Does it Work?
The basic Web services platform is XML +
HTTP.
XML provides a language which can be used
between different platforms and programming
languages and still express complex messages
and functions.
The HTTP protocol is the most used Internet
protocol.
7/30/2019 Topik 5.1 Understand Web Forms
32/41
7/30/2019 Topik 5.1 Understand Web Forms
33/41
Elements
Web services platform elements:
SOAP (Simple Object Access Protocol)
UDDI (Universal Description, Discovery and
Integration)
WSDL (Web Services Description Language)
7/30/2019 Topik 5.1 Understand Web Forms
34/41
How its works?
7/30/2019 Topik 5.1 Understand Web Forms
35/41
What is SOAP
SOAP is an XML-based protocol to let
applications exchange information over HTTP.
Or more simple: SOAP is a protocol for
accessing a Web Service.
7/30/2019 Topik 5.1 Understand Web Forms
36/41
About SOAP
SOAP stands for Simple Object Access Protocol
SOAP is a communication protocol
SOAP is a format for sending messages
SOAP is designed to communicate via Internet SOAP is platform independent
SOAP is language independent
SOAP is based on XML
SOAP is simple and extensible SOAP allows you to get around firewalls
SOAP is a W3C standard
7/30/2019 Topik 5.1 Understand Web Forms
37/41
What is WSDL?
WSDL is an XML-based language for locating
and describing Web services.
WSDL stands for Web Services Description
Language
WSDL is based on XML
WSDL is used to describe Web services
WSDL is used to locate Web services WSDL is a W3C standard
7/30/2019 Topik 5.1 Understand Web Forms
38/41
What is UDDI?
UDDI is a directory service where companies
can register and search for Web services.
UDDI stands for Universal Description, Discovery and
Integration UDDI is a directory for storing information about web
services
UDDI is a directory of web service interfaces described by
WSDL UDDI communicates via SOAP
UDDI is built into the Microsoft .NET platform
7/30/2019 Topik 5.1 Understand Web Forms
39/41
Advantages
Reusable application-components.
There are things applications need very often
Connect existing software.
Web services can help to solve the interoperability
problem by giving different applications a way to
link their data.
With Web services you can exchange databetween different applications and different
platforms.
7/30/2019 Topik 5.1 Understand Web Forms
40/41
Conclusion
Web service is one of the greatest
technologies in the Internet world; it can be
used to connect businesses with each other
and clients in a standard way using XML(Extensible Markup Language), SOAP (Simple
Object Access Protocol), WSDL (Web Services
Description Language) and UDDI (UniversalDescription, Discovery and Integration).
7/30/2019 Topik 5.1 Understand Web Forms
41/41
Conclusion
XML is used for structuring the data, SOAP is
used to transfer the data, WSDL is used for
describing the services and UDDI is used to get
a list of services available.
Web service allows applications to
communicate with each other without
worrying about hardware systems, operatingsystems and programming languages.