17_Developing the Business Tier Web Services
-
Upload
suresh1130 -
Category
Documents
-
view
216 -
download
0
Transcript of 17_Developing the Business Tier Web Services
-
8/14/2019 17_Developing the Business Tier Web Services
1/42
17Copyright 2007, Oracle. All rights reserved.
Developing the Business Tier with
Web Services
-
8/14/2019 17_Developing the Business Tier Web Services
2/42
17-2 Copyright 2007, Oracle. All rights reserved.
Objectives
After completing this lesson, you should be able to do
the following:
Define Service-Oriented Architecture (SOA)
Describe the benefits of Web services Identify Web services components
Create a Web service
Utilize a Web service from a client
-
8/14/2019 17_Developing the Business Tier Web Services
3/42
17-3 Copyright 2007, Oracle. All rights reserved.
What Is Service-Oriented
Architecture (SOA)?
SOA is a software design pattern that implements a set
of reusable services by using standard elements:
Service
description
Communication protocol
Service
registry
-
8/14/2019 17_Developing the Business Tier Web Services
4/42
17-4 Copyright 2007, Oracle. All rights reserved.
SOA: Development Life Cycle
Orchestrate
Change
Integrate
Manage
Secure
Monitor
Develop
-
8/14/2019 17_Developing the Business Tier Web Services
5/42
17-5 Copyright 2007, Oracle. All rights reserved.
What Is a Web Service?
A Web service is:
A software component whose technology is based
on a set of standards for building interoperable
distributed applications A set of self-describing business functions
Service oriented
Component based
-
8/14/2019 17_Developing the Business Tier Web Services
6/42
17-6 Copyright 2007, Oracle. All rights reserved.
-
8/14/2019 17_Developing the Business Tier Web Services
7/4217-7 Copyright 2007, Oracle. All rights reserved.
Benefits of Web Services
Distributed component model with interoperability
XML format for representing data. The request andresponse messages are in the XML format.
Programming language independent Easily accessible with standard protocols such as
HTTP, HTTPS, SMTP, and FTP
Communication through firewalls
Existing components can be exposed as
Web Services to save development time Different communication styles:
RPC style (synchronous)
Message style (asynchronous)
-
8/14/2019 17_Developing the Business Tier Web Services
8/4217-8 Copyright 2007, Oracle. All rights reserved.
-
8/14/2019 17_Developing the Business Tier Web Services
9/4217-9 Copyright 2007, Oracle. All rights reserved.
Web Services and SOA
Web services are a technology that can be used in
SOA:
Service
description(WSDL)
Communication protocol (SOAP)
Service
registry
(UDDI)
-
8/14/2019 17_Developing the Business Tier Web Services
10/4217-10 Copyright 2007, Oracle. All rights reserved.
Web Services Model
Web Servicesdirectory
(UDDI)
XML interface (WSDL)
Web service
Find
Invoke Publish
1
2
3
XML interface (WSDL)
Client application
SOAP
-
8/14/2019 17_Developing the Business Tier Web Services
11/4217-11 Copyright 2007, Oracle. All rights reserved.
Anatomy of a Service
Service consumer
Interface Proxy
Service
interface
Service
implementation
New service
Wrapped
legacy
Composite
service
-
8/14/2019 17_Developing the Business Tier Web Services
12/4217-12 Copyright 2007, Oracle. All rights reserved.
Defining Web Services
A Web service is:
A self-describing business function
A small application sending data to a Web browser
using Web services
Web services:
Refer to a standard set of platform independentmessaging protocols (SOAP, HTTP, JMS)
Enable connections between services from any
Web-connected device
Exchange data and functionality in XML format
Web ServiceWeb browser
Request
Response
-
8/14/2019 17_Developing the Business Tier Web Services
13/4217-13 Copyright 2007, Oracle. All rights reserved.
WSDL
Web Service(J2EE, PL/SQL,
.NET,C/C++,
Legacy )
Web Serviceclient
(J2EE, .NET,
PL/SQL )
Points to
description
Describes and
Points to
Web Service
Finds
service
Invokes with
XML messages
Basic Web Services
SOAP
UDDI
registry
-
8/14/2019 17_Developing the Business Tier Web Services
14/4217-14 Copyright 2007, Oracle. All rights reserved.
Two Development Use Cases
Service
implementation
Example: EJB/Java
class to WSDL
Example: WSDL contract as the
interface and message description
Bottom-Up Top-Down/Contract Driven
WSDL WSDL
Service
implementation
-
8/14/2019 17_Developing the Business Tier Web Services
15/4217-15 Copyright 2007, Oracle. All rights reserved.
JAX-RPC
Core Web services standard for Java:
Enables portability across containers
Standard class and interface structure for client and
server
Various hook points for custom serializers, custom
handlers, attachments
Tools must provide abstractions to handle service
as a set of classes.
Navigator structure for quick location Wizard support for declarative definition
-
8/14/2019 17_Developing the Business Tier Web Services
16/4217-16 Copyright 2007, Oracle. All rights reserved.
Simple Object Access Protocol (SOAP)
Supports RPC or message-oriented information
exchange
Features:
Protocol independence Language independence
Platform independence
Attachments (MIME)
Message consists of envelope
containing header (optional)
and body
SOAP header
SOAP body
-
8/14/2019 17_Developing the Business Tier Web Services
17/4217-17 Copyright 2007, Oracle. All rights reserved.
Web Services Definition
Language (WSDL)
Is a definition language to define Web service
interfaces and how to invoke them
Is an XML Schema for defining Web services: Service interface definition: Describes what
message must be sent and what message isreturned
Service implementation definition: Describes towhich address the message must be sent
Allows both the messages and the operations on
the messages to be defined abstractly in XML Answers three key questions about a Web service:
What does a service do?
How is a service accessed?
Where is a service located?
-
8/14/2019 17_Developing the Business Tier Web Services
18/4217-18 Copyright 2007, Oracle. All rights reserved.
Web Services Definition
Language (WSDL)
... ... ....
.. ..
-
8/14/2019 17_Developing the Business Tier Web Services
19/4217-19 Copyright 2007, Oracle. All rights reserved.
-
8/14/2019 17_Developing the Business Tier Web Services
20/4217-20 Copyright 2007, Oracle. All rights reserved.
Anatomy of a WSDL Document
A
has a number of
with input
and output.
A
composed of
describes the structure
of an .
A
describes
style of an
.
A
describes describesthe and
for a
specific .
-
8/14/2019 17_Developing the Business Tier Web Services
21/4217-21 Copyright 2007, Oracle. All rights reserved.
Other Web Service Features
Run and test
Deploy
Use Http Analyzer
Test for WS-Icompliance
WSDL
Running service
Quality of Service Reliability, security
Auditing, logging
-
8/14/2019 17_Developing the Business Tier Web Services
22/4217-22 Copyright 2007, Oracle. All rights reserved.
Using Http Analyzer
Sets dummy proxy
Intercepts messages
Configurable
Headers
Next/Previous Resend
-
8/14/2019 17_Developing the Business Tier Web Services
23/4217-23 Copyright 2007, Oracle. All rights reserved.
Why Web Services and Applications?
UIGeneration
Binding
abstraction
DatabaseApplication server(s)Client
Business
Service
Facade
Rules
EngineBPEL
Engine
-
8/14/2019 17_Developing the Business Tier Web Services
24/4217-24 Copyright 2007, Oracle. All rights reserved.
UDDI Registry
Is an online electronic registry for registering
businesses and Web services
Is a specification for description and discovery
Supports the Publishing and Inquiry APIs topublish and
inquire about a
Web service
-
8/14/2019 17_Developing the Business Tier Web Services
25/42
17-25 Copyright 2007, Oracle. All rights reserved.
-
8/14/2019 17_Developing the Business Tier Web Services
26/42
17-26 Copyright 2007, Oracle. All rights reserved.
Options for Located Web Service
-
8/14/2019 17_Developing the Business Tier Web Services
27/42
17-27 Copyright 2007, Oracle. All rights reserved.
UDDI Publishing and Browsing with
Oracle Enterprise Manager
Using Oracle Enterprise Manager Application Server
Control, you can:
Browse and register services within the UDDI
registry
Publish Web services and deploy them to a
Java EE container
Monitor and administer Web services
-
8/14/2019 17_Developing the Business Tier Web Services
28/42
17-28 Copyright 2007, Oracle. All rights reserved.
Oracle Application Server 10g
Web Services
Oracle Application Server10gWeb Services can beimplemented as any of thefollowing:
Stateless and statefulJava classes
Stateless PL/SQLpackages or Webservices
Stateless sessionEnterprise JavaBeans(EJBs)
Java Message Service(JMS) destinations
-
8/14/2019 17_Developing the Business Tier Web Services
29/42
17-29 Copyright 2007, Oracle. All rights reserved.
Developing a Web Service
with a Stateless Java Class
To develop a Web service with a stateless Java class,
perform the following steps:
1. Define an interface.
2. Define a stateless Java class.3. Generate an .ear file.
4. Deploy the generated .ear file to Oracle
Application Server 10g.
-
8/14/2019 17_Developing the Business Tier Web Services
30/42
17-30 Copyright 2007, Oracle. All rights reserved.
Defining an Interface
-
8/14/2019 17_Developing the Business Tier Web Services
31/42
17-31 Copyright 2007, Oracle. All rights reserved.
Defining a Stateless Java Class
-
8/14/2019 17_Developing the Business Tier Web Services
32/42
17-32 Copyright 2007, Oracle. All rights reserved.
-
8/14/2019 17_Developing the Business Tier Web Services
33/42
17-33 Copyright 2007, Oracle. All rights reserved.
Creating the Web Service
Invoking JDevelopers
Create Web Service
Wizard
-
8/14/2019 17_Developing the Business Tier Web Services
34/42
17-34 Copyright 2007, Oracle. All rights reserved.
Examining the Web Service Files
-
8/14/2019 17_Developing the Business Tier Web Services
35/42
17-35 Copyright 2007, Oracle. All rights reserved.
Deploying the Web Service
Options:
To embedded OC4J
Directly to application server
To WAR or EAR file
-
8/14/2019 17_Developing the Business Tier Web Services
36/42
17-36 Copyright 2007, Oracle. All rights reserved.
Web Service Home Page
A Web service home page provides:
A link to the service definition (WSDL file)
Links to Web service test pages to test the
available operations of the Web service A link to the Web service client-side proxy JAR
A link to the Web service client-side proxy source
-
8/14/2019 17_Developing the Business Tier Web Services
37/42
17-37 Copyright 2007, Oracle. All rights reserved.
Testing the Deployed Web Service
with Home Page
-
8/14/2019 17_Developing the Business Tier Web Services
38/42
17-38 Copyright 2007, Oracle. All rights reserved.
Testing the sayHello Operation
-
8/14/2019 17_Developing the Business Tier Web Services
39/42
17-39 Copyright 2007, Oracle. All rights reserved.
Exposing and Publishing a PL/SQL
Package as a Web Service
-
8/14/2019 17_Developing the Business Tier Web Services
40/42
17-40 Copyright 2007, Oracle. All rights reserved.
Summary
In this lesson, you should have learned how to:
Describe a Web service in terms of
Service-Oriented Architecture
Describe that Web services employ a distributedcomponent model, use XML, and are programming
language independent
Create, publish, find, and invoke a Web service
Describe how WSDL is used to define a WS
functionality, how it communicates, and where it isaccessible
Describe how the UDDI registry supports
publishing and inquiry about Web services
-
8/14/2019 17_Developing the Business Tier Web Services
41/42
17-41 Copyright 2007, Oracle. All rights reserved.
Practice Overview:
Creating a Web Service
This practice covers the following topics:
Developing a Web service
Consuming a Web service
-
8/14/2019 17_Developing the Business Tier Web Services
42/42