Practical Lecture5 PDF
Practical Lecture5 PDF
5 6
•1
•3/20/2016
7 8
11 12
•2
•3/20/2016
15 16
•3
•3/20/2016
19 20
21 22
• Rename this to
PTSCustomerWebService.asmx Inherits from
– This will be our web service to be WebService
used by the Customer browser
website
– The only functionality this needs to
Any method you want to make
offer is authentication and retrieval available through the web
of project details service needs to be marked as
a [WebMethod]
23 24
•4
•3/20/2016
27 28
29 30
•5
•3/20/2016
31 32
35 36
•6
•3/20/2016
Remember, it’s
PTSClientFacade now, not
PTSCustomerFacade
37 38
41 42
•7
•3/20/2016
43 44
• When we created the web site project, a • An ASP.NET web form actually consists of two
files:
default web form called Default.aspx was – XXX.aspx – this file contains HTML-like markup code,
created which is used to design the layout of the web form
(you can see the code when you are in Source view)
– Double-click on this file to open it
– XXX.aspx.cs – this is the C# code behind the
• You will notice that you can toggle XXX.aspx page. It contains the business logic driving
between Design and Source view the display laid out in the visual design surface and
mark-up.
– Code behind is a direct attempt to separate display
from business logic
45 46
Design of Default.aspx
• Change to Design view and add the
following controls: Design of Default.aspx /2
– 2 Labels saying Username and Password
– 2 TextBoxes (txtUsername, txtPassword)
– 1 Button (btnLogin), saying Login
– 1 Label (lblMessage) with text set to nothing
• Have a look at the next slide to see what it
should look like
47 48
•8
•3/20/2016
automatically be generated
• Start by declaring an instance of the web
service class Saves id Successful
in session authentication redirects
the user to the
ProjectDetails.aspx page
49 50
ProjectDetails.aspx /2 ProjectDetails.aspx /3
If the page is • Double-click on the ProjectDetails.aspx form and
accessed without
being logged in, change to Source view
redirect to login
page
Response.Write
writes to current
HTTP output 53 54
•9
•3/20/2016
Summary
• In this session we have looked at what
web services are and how they work
• We built two web services to be used by
the customer website and the Java client
• No-argument constructors were introduced
in the business classes of the PTSLibrary
• A customer website was created
• In the next session we will create a Java
client that uses the client web service
57
•10