Title: Web Services Overview
1Web Services Overview
2Sang Shin sang.shin_at_sun.com Java Technology
Evangelist Sun Microsystems, Inc. www.javapassion.
com/webservices
3Disclaimer
- Even though Sang Shin is a full-time employee of
Sun Microsystems, the contents here are created
as his own personal endeavor and thus does not
reflect any official stance of Sun Microsystems. - Sun Microsystems is not responsible for any
inaccuracies in the contents.
4Agenda
- Evolution of network computing
- What is Web Services?
- Why Web Services?
- Where is Web Services?
- Web Services Architecture
- Web Services Standards
- Java APIs for Web Services
- J2EE as platform of choice for Web Services
- Web Services Tools
- Roadmap and Summary
5Evolution of Network Computing
6What is Web Services?
7The New Software
Payment
Developer
X1
Locater
X106
NewService
UsersDevice
X106
Calendar
Authentication
Software-as-a-Service
Shrink Wrap
8Simple WS Metaphors
- A WS is text-messaging between systems instead of
humans - Systems cant understand free-form text messages
like humans can - So, all WS messages must conform to a defined
structure (protocol)
9Simple WS Metaphors
- Other distributed protocols are typically binary
(RMI-IIOP), this severely complicates
interoperability - How can a COBOL program talk to a Java program
- The simplest protocol is text-based
(ASCII/Unicode) - XML is the ideal choice for specifying text-based
WS protocols
10Simple WS Metaphors
- How do WS clients google WS providers?
- How does a WS client surf to a WS server of
interest?
11(Simplified) Web Service Architecture
Registry
Service Client
Web Service
12Web 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
13Distributed Computing Evolution
Servers
Servers
Cell Phone
Clients
PDA
Internet
Client-Server(C/S) silos
Server
Clients
Workstation
Web-based computing
Laptop
Kiosk
Web Services/Peer-to-Peer
14 Traditional C/S vs. Web Services
Web Service
Traditional C/S
- Within enterprise
- Tied to a set of programming languages
- Procedural
- Usually bound to a particular transport
- Tightly-coupled
- Efficient processing (space/time)
- Between enterprises
- Program language independent
- Message-driven
- Easily bound to different transports
- Loosely-coupled
- Relatively not efficient processing
15Web Application vs. Web Services
Web Service
Web Application
- User-to-program interaction
- Static integration of components
- Monolithic service
- Program-to-program interaction
- Possibility of dynamic integration of components
(in the future) - Possibility of service aggregation (in the future)
16Characteristics 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
17Web Services
Service registration
Service Registry
18Service Aggregation
19 Why Web Services?
20Why Web Services?
- Web Services
- Are platform neutral
- Are accessible in a standard way
- Are accessible in an interoperable way
- Use simple and ubiquitous plumbing
- Are relatively cheap
- Simplify enterprise integration
21Why Web Services?
- Interoperable Connect across heterogeneous
networks using ubiquitous web-based standards - Economical Recycle components, no installation
and tight integration of software - Automatic No human intervention required even
for highly complex transactions - Accessible Legacy assets internal apps are
exposed and accessible on the web - Available Services on any device, anywhere,
anytime - Scalable No limits on scope of applications and
amount of heterogeneous applications
22Web Services Usage Example
Internet
Growing need for a standard lightweight
infrastructure for data exchange in e-business
applications.
23Impact of Web Services on SoftwareApplication
Dis-Integration
Web Services
Monolithic Software
The Network
24Macro web services Virtual Systems
Web Services
- A web service is accessed programmatically by
applications or otherweb services
Bank Balance
Stock Position
Insurance Cash Value
Biz News
Portfolio can be an application, a portal
channel, or a web service itself
World News
25Micro web services Virtual Apps
- A web service is accessed programmatically by
applications or otherweb services
Web Services
Spell Check
Dictionary
Thesaurus
c\...
Word processing can be an application, a
capability, or a web service itself
http//...
26Three Laws of Computing
- Moore's Law
- Computing power doubles every 18 months
- Gilder's Law
- Network bandwidth capacity doubles every 12
months - Metcalfe's Law (Net Effect)
- Value of network increases exponentially as
number of participants increases
27Impact on IntegrationTrigger the Network Effect
CustomIntegration
Web Services
Metcalfes Law The value of the network is
proportional to the square of the number of
participants
28Myth Web Services is a New Concept
- Web services is distributed computing all over
again only now it is based on the web
29Other Popular Myths Surrounding Web Services
- Web services require only SOAP, WSDL, UDDI We
need more high-level semantics - Web services are based on the RPC paradigm
Document-driven model would be more popular
communication model - Web services must be based on HTTP Other
transports such as SMTP can be also used
30 Where is Where is Web Services going?
31Myths about Web Services
- Web Services cure cancer Not for a very very
long time! - Web Services are something completely new Not
True! - You have to write Web Services from scratch Not
True! - J2EE Platform does not support web services Not
True!
32State of Web Services
- Technology/Standards are still evolving
- SOAP, WSDL, UDDI are not enough
- Business web services is the next big thing, but
more works are needed in - Quality of Service, management
- Security, transaction, state and user context
- Work flow, Identity management,
- Provisioning, Accounting
- Will be adopted in phases
33Web Services Adoption Phases
- 1st phase (current state)
- Concerted deployment internally within an
organization mainly for interoperability - SOAP over HTTP/S
- 2nd phase (1 to 2 years)
- Selective and non-aggregate deployment with
trusted outside business partners - Private registry deployment
- 3rd phase (at least 3 to 4 years away)
- Wider, more dynamic and aggregate deployment with
outside business partners - Public registry deployment
34Business Web Services (B2B) Architectural
Components (ebXML)
- B2B collaboration
- Secure and reliable message delivery
- Non-repudiation
- Partner profile
- Repository for business data objects
35B2B Collaboration
Simple Web Services
B2B Collaboration
- Complex interaction
- Business oriented
- Long-running process
- Supports business collaboration
- Supports partner profile
- Secure and reliable and non-repudiation
- Supports non-repudiation
- Registry and repository
- Supports legal binding
- Simple interaction
- Consumer oriented
- Short-living process
- No business collaboration
- No partner profile
- Not secure, not reliable
- Does not support non-repudiation
- No repository support
- No legal binding
36Trends Towards Service Orientation
- Evolution of EAI to web service standards
- XML RPC gt Asynchronous XML Messaging
- Towards de-centralization
- Componentized services
- Composable and composite services
- Data encapsulated within component
- Data ownership follows component ownership
- Brokered web services
- Flexible relationships gt Adaptive businesses
37Simple Web Services Architectural Components (WUS)
- Service Description
- Service Registration (Publication) and Discovery
- Service Invocation
38 Core Web Services Standards
39(Simplified) Web Service Architecture
Registry
Service Client
Web Service
40SOAP (Simple Object Access Protocol)
41SOAP
- Simple Object Access Protocol
- Wire protocol similar to
- IIOP for CORBA
- JRMP for RMI
- XML is used for data encoding
- text based protocol vs. binary protocol
- Supports XML-based RPC
42What SOAP is Not
- Not a component model
- So it will not replace objects and components,
i.e. EJB, JavaBeans - Not a programming language
- So it will not replace Java
- Not a solution for all
- So it will not replace other distributed
computing technologies such as RMI
43What does SOAP Define?
- Message Envelope
- Encoding Rules
- RPC Convention
- Binding with underlying protocols
44SOAP Message Format
SOAP Envelope
SOAP Message
SOAP Header
Primary MIME part (text/xml)
Header Entry
Header Entry
Attachment
SOAP Body
Attachment
Body Entry
Body Entry
Attachment
45SOAP Message Envelope
- Encoding information
- Header
- Optional
- Could contain context knowledge
- Security
- Transaction
- Body
- RPC methods and parameters
- Contains application data
46SOAP Encoding
- Rules of expressing application-defined data
types in XML - Based on W3C XML Schema
- Simple values
- Built-in types from XML Schema, Part 2 (simple
types, enumerations, arrays of bytes) - Compound values
- Structs, arrays, complex types
47SOAP RPC Request Example
- ltSOAP-ENVEnvelope xmlnsSOAP-ENV""
SOAP-ENVencodingStyle""gt - ltSOAP-ENVHeadergt
- lt!-- Optional context information --gt
- lt/SOAP-ENVHeadergt
- ltSOAP-ENVBodygt ltmGetLastTradePrice
xmlnsmsome_URI"gt lttickerSymbolgtSUNWlt/t
ickerSymbolgt lt/mGetLastTradePricegtlt/SOAP-ENV
Bodygt - lt/SOAP-ENVEnvelopegt
48SOAP RPC Response Example
- ltSOAP-ENVEnvelope xmlnsSOAP-ENV""
SOAP-ENVencodingStyle""gt - ltSOAP-ENVHeadergt
- lt!-- Optional context information --gt
- lt/SOAP-ENVHeadergt
- ltSOAP-ENVBodygt ltmGetLastTradePriceResponse
xmlnsmsome_URI"gt ltpricegt30.5lt/pricegt
lt/mGetLastTradePriceResponsegtlt/SOAP-ENVBodygt - lt/SOAP-ENVEnvelopegt
49SOAP RPC
- Information needed for a method call
- The URI of the target object
- ltSOAP-ENVBodygt
- ltmGetLastTradePrice
- xmlnsmhttp//stocks.com/StockQuotes
"gt - lttickerSymbolgtSUNWlt/tickerSymbol
gt - lt/mGetLastTradePricegt
- lt/SOAP-ENVBodygt
50SOAP RPC
- Information needed for a method call
- The URI of the target object
- Method name
- ltSOAP-ENVBodygt
- ltmGetLastTradePrice
- xmlnsmhttp//stocks.com/StockQuotes
"gt - lttickerSymbolgtSUNWlt/tickerSymbol
gt - lt/mGetLastTradePricegt
- lt/SOAP-ENVBodygt
51SOAP RPC
- Information needed for a method call
- The URI of the target object
- Method name
- Parameters
- ltSOAP-ENVBodygt
- ltmGetLastTradePrice
- xmlnsmhttp//stocks.com/StockQuotes
"gt - lttickerSymbolgtSUNWlt/tickerSymbol
gt - lt/mGetLastTradePricegt
- lt/SOAP-ENVBodygt
52Quick WSDL Tutorial
53What is WSDL?
- XML language for describing web services
- Web service is described as
- A set of communication endpoints (ports)
- Endpoint is made of two parts
- Abstract definitions of operations and messages
- Concrete binding to networking protocol (and
corresponding endpoint address) and message
format - Why this separation?
- Enhance reusability (as we will see in UDDI
reference to WSDL document)
54Why WSDL?
- Enables automation of communication details
between communicating partners - Machines can read WSDL
- Machines can invoke a service defined in WSDL
- Discoverable through registry
- Arbitration
- 3rd party can verify if communication conforms to
WSDL
55WSDL Document Example
- Simple service providing stock quotes
- A single operation called GetLastTradePrice
- Deployed using SOAP 1.1 over HTTP
- Request takes a ticker symbol of type string
- Response returns price as a float
56WSDL Elements
- Types
- Message
- Operation
- Port Type
- Binding
- Port
- Service
57WSDL Elements
- Types
- Data type definitions
- Used to describe exchanged messages
- Uses W3C XML Schema as canonical type system
58WSDL Example Types
- ltdefinitions name"StockQuote"
- targetNamespace"http//example.com/stockquote.
wsdl" - xmlnstns"http//example.com/stockqu
ote.wsdl" - xmlnsxsd1"http//example.com/stockq
uote.xsd" - xmlnssoap"http//schemas.xmlsoap.or
g/wsdl/soap/" - xmlns"http//schemas.xmlsoap.org/wsd
l/gt - lttypesgt
- ltschema targetNamespace"http//example.com
/stockquote.xsd" - xmlns"http//www.w3.org/2000/10/XML
Schema"gt - ltelement name"TradePriceRequest"gt
- ltcomplexTypegt
- ltallgt
- ltelement nametickerSymbol"
type"string"/gt - lt/allgt
- lt/complexTypegt
- lt/elementgt
- ltelement name"TradePrice"gt
- ltcomplexTypegt
- ltallgt
59WSDL Elements
- Messages
- Abstract, typed definitions of data being
exchanged - Operations
- Abstract description of an action
- Refers to an input and/or output messages
- Port type
- Collection of operations
- Abstract definition of a service
60Example Messages, Operation, Port type
- ltmessage name"GetLastTradePriceInput"gt
- ltpart name"body" element"xsd1TradePriceRequ
est"/gt - lt/messagegt
- ltmessage name"GetLastTradePriceOutput"gt
- ltpart name"body" element"xsd1TradePrice"/gt
- lt/messagegt
- ltportType name"StockQuotePortType"gt
- ltoperation name"GetLastTradePrice"gt
- ltinput message"tnsGetLastTradePriceInput"
/gt - ltoutput message"tnsGetLastTradePriceOutpu
t"/gt - lt/operationgt
- lt!-- More operations --gt
- lt/portTypegt
61WSDL Elements
- Binding
- Concrete protocol and data format for a
particular Port type - Protocol example SOAP 1.1 over HTTP or SOAP 1.1
over SMTP - Port
- Defines a single communication endpoint
- Endpoint address for binding
- URL for HTTP, email address for SMTP
- Service
- Aggregate set of related ports
62Example Binding, Port, Service
- ltbinding name"StockQuoteSoapBinding"
type"tnsStockQuotePortType"gt - ltsoapbinding style"document"
- transport"http//schemas.xmlsoap.org/soa
p/http"/gt - ltoperation name"GetLastTradePrice"gt
- ltsoapoperation
- soapAction"http//example.com/GetLast
TradePrice"/gt - ltinputgt ltsoapbody use"literal" /gt
- lt/inputgt
- ltoutputgt ltsoapbody use"literal" /gt
- lt/outputgt
- lt/operationgt
- lt/bindinggt
- ltservice name"StockQuoteService"gt
- ltdocumentationgtMy first servicelt/documentationgt
- ltport name"StockQuotePort" binding"tnsStockQ
uoteBinding"gt - ltsoapaddress location"http//example.com/
stockquote"/gt - lt/portgt
- lt/servicegt
63UDDI
64Service Architecture
UDDI Registry
Service Client
Web Service
UDDI defines a way to publish and find
information about Web services.
65UDDI (Universal Description, Discovery and
Integration)
- White pages
- address, contact, and known identifiers
- Yellow pages
- industrial categorizations
- Industry NAICS (Industry codes - US Govt.)
- Product/Services UN/SPSC (ECMA)
- Location Geographical taxonomy
- Green pages
- technical information about services
66Other Web Services Standards
67ebXML
- A global electronic market place where
enterprises of any size, anywhere can - Find each other electronically
- Conduct business through exchange of XML based
business messages
68More Web Services Standards
- Security
- XML Signature, XML Encryption, XKMS, XACML, SAML,
Liberty, WS-Security - Transaction
- BTP, WS-Transaction
- Business collaboration and choreography
- ebXML BPSS, ebXML CPP/CPA, BPML, WSFL, XLANG,
WSCI, BPEL4WS
69More Web Services Standards
- Business Language
- UBL (Universal Business Language)
- Component model
- WSIA (Web Services for Interactive Application)
- Portal
- WSRP (Web Services for Remote Portals)
70Java APIs for Web Services
71Java APIs for SOAP, WSDL, UDDI
- SOAP Messaging
- JAXM (JSR 67), SAAJ, JAX-RPC (JSR 101), JMS
- WSDL
- Java API for WSDL (JSR 110)
- JAX-RPC (JSR 101)
- UDDI
- JAXR (JSR 67)
72Java APIs for ebXML
- ebXML Message Service (TRP)
- JAXM (JSR 67) with ebXML Message Service profile
- ebXML Registry/Repository
- JAXR (JSR 93)
- CPP/CPA
- Java API for ebXML CPP/CPA (JSR 157)
73J2EE Web Services Framework
- J2EE 1.4 (JSR 151)
- Web services for J2EE (JSR 109)
- JAX-RPC (JSR 101)
- JAXR
- SAAJ
- EJB 2.1
74Java APIs for XML Document Management
- JAXP (Java API for XML processing, JSR 05)
- Assembly language for XML document processing
- JAXB (Java API for XML data-binding, JSR 31)
- Higher level language for XML document processing
- Streaming API for XML (JSR 173)
- Pull-parsing API based on Iterator
- Gives parsing control to programmers
75Java APIs for XML Security
- XML Digital Signature (JSR 105)
- XML Encryption (JSR 106)
- XML Trust Service (JSR 104)
- Secure Assertion Markup Language (SAML, JSR 155)
- WS-Security (JSR 183)
76More Java APIs for Web Services
- XML Transactioning API for Java (JSR 156)
- Java API for OASIS BTP
- Web Services for J2ME (JSR 172)
- SOAP messaging for J2ME devices
- Web Services Metadata for J2EE (JSR 181)
- Metadata based Web services
77Web Services Framework for J2EE
78J2EE Platform Web Services
B2B Applications
Existing Applications
B2C Applications
WebServices
Application Server
EnterpriseInformationSystems
Wireless Applications
79Why J2EE for Web Services?
- Web services is just one of many service delivery
channels of J2EE - No architectural change is needed
- Existing J2EE components can be easily exposed as
Web services - Many benefits of J2EE are preserved for Web
services - Portability, Scalability, Reliability
- No single-vendor lock-in
80Where Are We Now?
- Java APIs for Web Services are being developed
very rapidly - Tools are available now for exposing existing
J2EE components as Web services - J2EE community has defined overall framework for
Web Services (J2EE 1.4, JSR 109)
81Design Goals J2EE Web Services Framework
- Portability of Web services component
- Over different vendor platform
- Over different operational environment
- Leveraging existing J2EE programming models for
service implementation - Easy to program and deploy
- High-level Java APIs
- Use existing deployment model
82J2EE Web Services Framework
- J2EE 1.4
- Umbrella framework for Web services
- JSR 109, JAX-RPC, JAXR, EJB 2.1, Servlet 2.4,
- JAX-RPC
- Defines client programming model
- Defines Servlet-based Web services endpoint model
83J2EE Web Services Framework
- EJB 2.1
- Defines Stateless Session Bean-based Web services
endpoint model - Servlet 2.4
- Will be aligned with JAX-RPC
- JSR 109
- Defines standard Web services packaging and
deployment model
84Web Services Architecture over J2EE
85What Is a Web Service?
- A set of endpoints (ports) operating on messages
- Ports are operating within a container
- Container provides runtime environment
- Contract for runtime environment are specified in
JAX-RPC, EJB 2.1, JSR 109 - Service is described in WSDL document and
published to a registry - WSDL specifies a contract between service
provider and client
86Web Service Component and Container
- Container vs. Component model
- Web services components get executed within a
container - Components are portable (under J2EE 1.4)
- Web service components
- Web-tier (Servlet-based endpoint)
- EJB-tier (Stateless session bean-based endpoint)
87Web Service Components
Web services components
Source Web Services for J2EE (JSR 109), V1.0
88Java Technology-based Web Services Tools
89Web Services Tools for Java Platform
- Web Services Tools (Available Now!)
- Tools that come with reference implementations of
Java APIs for Web services (JAX-RPC RI) - Systinet (Idoox), Iopsys, Cape Clear, Apach SOAP
- IDE's (Now!)
- Sun Java Enterprise Studio 7
- JBuilder from Borland
- JDeveloper from Oracle
- WebGain from WebGain
90J2EE 1.4
- Focus is Web services
- Umbrella JSR for all Java APIs for Web services
- JSR 109, JAX-RPC, JAXR, EJB 2.1
- Web services framework for J2EE
- J2EE component model, deployment, packaging, and
container requirements - Released in Nov. 2003
- http//java.sun.com/j2ee/1.4/download-dr.html
91J2EE 1.4 SDK
- Web services APIs are well integrated
- Contains
- JAXP, SAAJ, JAX-RPC, JAXR
- Sun Java App Server PE 8
- Extensive tutorial
92Summary
93Summary
- Web services provides a new paradigm for program
to program communication - Comprehensive set of Java APIs for Web Services
are now available! - J2EE is the platform of choice for Web services
94Passion!