Topics to be covered
(ni)
• Client side validation
• JSF (free tools as well)
• Webservices
• Tell Resources e.g. sites
• Packaging and deploying web applications
• Big Enterprise diagram re-visit
• What to do next (EJBs)
• Wrap up
• Give acknowledgment
Packaging and Deploying
Web Application (ni)
• Agenda
– Web application, components and Web container
– Web application development and deployment steps
– Web Application Archive (*.WAR file)
• WAR directory structure
• WEB-INF subdirectory
– Configuring Web application
• Web application deployment descriptor (web.xml file)
• Web application life-cycle management
– Installing & Deploying Web application
– Listing Web applications
Put a better pic here
(NI)
Web Components &
Container (NI)
– Web components are in the form of either Servlet or
JSP (along with JavaBean's, JSTL and custom tags)
– Web components run in a Web container e.g. Tomcat
– Web container provides system services to Web
components
• Request dispatching, security, and life cycle management
NI
• Web Application & Components
– Web Application is a deployable package
• Web components (Servlets and JSP's)
• Static resource files such as images
• Helper classes. Libraries
• Deployment descriptor (web.xml file)
– Web Application can be represented as
• A hierarchy of directories and files (unpacked form) or
• WAR file reflecting the same hierarchy (packed form)
• Development mode vs Deployment mode
NI
• Web Application Development and Deployment Steps
1. Write (and compile) the Web component code
(Servlet or JSP) and helper classes referenced by the web component code
2. Create any static resources (for example, images or HTML pages)
3. Create deployment descriptor (web.xml)
4. Build the Web application (*.war file or deployment-ready directory)
5. Install or deploy the web application into a Web container Web
clients are now ready to access it via URL
NI
• 4. Build the Web application
– Either *.WAR file or unpacked form of *.WAR file
• 5. Install or Deploy Web application
– Deploy the application over deployment platform such as Sun
Java System App Server or Tomcat
– Ways to deploy
– Use some console based command
• asadmin deploy --port 4848 --host localhost –passwordfile
"c:\j2eetutorial14\examples\common\adminpassword.
– Use some graphical interface of the server.
• App server admin console
– NetBeans
• What is *.WAR file?
– Ready to deploy'able package over web container
– Similar to *.jar file
– Contains things to be deployed
• Web services components
• Server-side utility classes
– Static Web presentation content (HTML, image, etc)
– Client-side classes (applets and utility classes)
– Reflects contents in build directory
NI
• Document Root & Context
– Document Root of the Web application is the Top-level directory
of WAR
– Contains JSP pages, client-side classes and archives, static Web
resources
– Also contains WEB-INF directory
• A context is a name that gets mapped to the document
root of a Web application
– /hello1 is context for hello1 example
– A way to distinguish Web applications in a single Web container
– Has to be specified as part of client URN (request path)
– Name of document root
NI
• HTTP request URL & Webcomponent URN (alias) &
Context
• Request URL: User specified access point of a web
resource
– http://[host]:[port]/[request path]?[query string]
– [request path] is made of context and web component's URN
– http://localhost:8080/hello1/greeting?username=Monica
• Context: Name of the root document of a web application
– Identifies a particular application on that server
– /hello1 is context
This picture shows the directory structure of *.war file. Please note that the
“WebApplicationName” directory reflects the Document root, thus the context.
• How to Create *.WAR file?
• 3 different ways
– Use IDE (NetBeans)
– Use ant tool after putting proper build
instruction in build.xml file
– Use “jar cvf <filename>.war .” command under
build directory
• Show demo here
Evolutionary Path
(NI)
• Client Server Model
• Web-based Computing
• Web Services Model-SOA
(Remove below after describing)
• In the beginning, things were built and deployed typically in the form of client and
server model in which clients talk to a single server, for example, doing remote
procedure calls or sockets
• The second phase can be called web-based computing in which many clients talk to
many servers through the net. In this phase, communicating partners still have to go
through some pre-arrangement in terms of what common object model they have to
use or what common communication protocol they have to agree upon. Largely end
user interaction with site
• Finally, the web services model. As we will see in the following slides, under web
services model, service users and service providers can be dynamically connected.
And the pretty much every computing device and application participate as both
service user and service provider. Example of service (NADRA-PASSPORT-PIA-
TRAVEL AGENT)
WEB Services (NI)
• Web services are Web-based enterprise
applications that use open, XML-based
standards and transport protocols to
exchange data with calling clients.
• Java Platform, Enterprise Edition (Java
EE) provides the APIs and tools you need
to create and deploy interoperable Web
services and clients
What is Web Services?
(NI)
• Web Services Definition by W3C
– A Web service is a software application
– identified by a URI,
– whose interfaces and binding are capable of being defined,
described and discovered by XML artifacts
– and supports direct interactions with other software applications
– using XML based messages via internet-based protocols
NI
NI
Comparison to the
Server/Browser Model
• Web page Web Service
– Has a UI No UI
– Interacts with users Interacts with
applications
– Works with web Works with any
browser client type client
(NI)
• Web application in its current form is typically focused on between an end
user and program
• while under web services model, program to program communication would
be much more common form of communication.
• Also under web application model, things are pretty much in static mode.
That is, in order to integrate various applications, you have to statically
configure them to talk each other.
• Under web services model, things could be a lot more dynamic, that is,
service users will find service provider and use the services of those
providers more dynamically.
• Also under Web services model, services can be aggregated again in a
adhoc and dynamic fashion.
Types of Web Services
• Data providers, e.g., a service providing stock
quotes
• Business-to-business process integration,
e.g., purchase orders
• Enterprise application integration
– Different applications work together simply by
adding a webservice wrapper.
Web Service
Architecture (correct it
accd. To VHS)
• Publishing the service—how do clients find it?
– UDDI (Universal Description, Discovery & Integration).
– A way to publish and find web services. A repository of web
services on the internet where a machine or a human can find
different web services
– www.uddi.org
• Describing the service—how do clients know
how it works (which functions, parameters etc)?
– WSDL (Web service description language)
pronounced as viz-dal
– An XML format for describing web services in terms of
methods , properties , data types and protocols.
– Makes the web service self describing
Some Web Service
Issues & Solutions…
(NI)
• Network—how can we avoid firewall issues (firewalls
generally block binary data)?
– Easy, we use HTTP and send XML over it (SOAP)
• Development tools—how can we build services in any
language?
– Very easy , use Visual studio .NET, JBuilder , Studio Creator ☺
• Plumbing—how can we simplify making all of this work?
– Again very easy , use Visual studio .NET, JBuilder , Studio
Creator ☺
XML Web Service Infrastructure
Make Your own
Summing up WebServices
(NI)
• Characteristics of Web Services
– XML based everywhere
– Message-based
– Programming language independent
– Could be dynamically located
– Could be dynamically assembled or aggregated
– Accessed over the internet
– Loosely coupled
– Based on industry standards
NI
Resources
• http://www.apl.jhu.edu/~hall/java/
Acknowledgment
• http://java.sun.com
• http://www.jsfcentral.com
• http://www.corejsf.com
• http://www.theserverside.com
• http://www.javaworld.com