soa and web services primer
TRANSCRIPT
-
8/6/2019 SOA and Web Services Primer
1/71
SOA & WEB SERVICES PRIMER
-
8/6/2019 SOA and Web Services Primer
2/71
Introduction
Expectations & Objectives
-
8/6/2019 SOA and Web Services Primer
3/71
Agenda
SOA
Web Services
Web Service design methodology (on a very high level)
Bottom up method Top down method
SOAP
The structure of SOAP messages: Envelope, Header and Body
WSDL
Structure of a WSDL and How to read a WSDLThe Message styles: RPC/Encoded, RPC/Literal, Document/Literal,
Wrapped and Bare
Comparison of the SOAP Engines Axis, Axis2, Metro and CXF
-
8/6/2019 SOA and Web Services Primer
4/71
Key Terms
SOA
SOAP
WSDL
JBI
ESB
-
8/6/2019 SOA and Web Services Primer
5/71
Service Oriented Architecture
SOA is a technical pattern for implementing cohesiveand loosely coupled (business and technical) functionswith well-defined interfaces.
Such services are consumed with the help of the detailsspecified in the interface without any knowledge ofthe implementation.
-
8/6/2019 SOA and Web Services Primer
6/71
Service Oriented Architecture
A service-oriented architecture is essentially a
collection of services.
These services communicate with each other.
-
8/6/2019 SOA and Web Services Primer
7/71
Service Oriented Architecture
A service is a function that is well-defined, self-contained, and does not depend on the context orstate of other services
The technology of web services is the most likelyconnection technology of service-orientedarchitectures.
Services
Connections
-
8/6/2019 SOA and Web Services Primer
8/71
Advantages of SOA
They offer business services across the platforms
They provide location independence
Services need not be at a particular system or particularnetwork
Completely loosely coupled approach
Authentication and authorization support at every levelThe search and connectivity to other services is dynamic
-
8/6/2019 SOA and Web Services Primer
9/71
Short-term benefits
Enhances reliability
Reduces hardware acquisition costs
Leverages existing development skills
Accelerates movement towards applicationconsolidation
Provides a data bridge between incompatibletechnologies
-
8/6/2019 SOA and Web Services Primer
10/71
Long-term benefits
Provides the ability to build composite applications
Creates a self-healing infrastructure that reduces
management costsProvides truly real-time decision-making applications
Enables the compilation of a unified taxonomy ofinformation across an enterprise and its customer andpartners
-
8/6/2019 SOA and Web Services Primer
11/71
Benefits from Business perspective
Ability to more quickly meet customer demands
Lower costs associated with the acquisition and
maintenance of technologyManagement of business functionality closer to the
business units
Leverages existing investments in technology
Reduces reliance on expensive custom development
-
8/6/2019 SOA and Web Services Primer
12/71
Web Services
-
8/6/2019 SOA and Web Services Primer
13/71
What is Web Service
Web Services can convert your application into a Web-application, which can publish its function or messageto the rest of the world.
-
8/6/2019 SOA and Web Services Primer
14/71
Why Web Service
-
8/6/2019 SOA and Web Services Primer
15/71
Services Provider, Service
Consumer, Registry
The figure above illustrates a basic service Request
Response
The request and subsequent response connections aredefined in some way that is understandable to both theservice consumer and service provider.
A service provider can also be a service consumer.
-
8/6/2019 SOA and Web Services Primer
16/71
Types of Web Service
The three most common styles of use are RPC, SOA andREST.
-
8/6/2019 SOA and Web Services Primer
17/71
RPC
RPC Web services present a distributed function (ormethod) call interface that is familiar with manydevelopers. Typically, the basic unit of RPC Webservices is the WSDL operation
-
8/6/2019 SOA and Web Services Primer
18/71
SOA
Web services can also be used to implement anarchitecture according to Service-orientedarchitecture (SOA) concepts, where the basic unit ofcommunication is a message, rather than anoperation. This is often referred to as message-oriented services
-
8/6/2019 SOA and Web Services Primer
19/71
REST
(REST) attempts to describe architectures which useHTTP or similar protocols by constraining theinterface to a set of well-known, standard operations(like GET, POST, PUT, DELETE for HTTP). Here, thefocus is on interacting with stateful resources, ratherthan messages or operations.
-
8/6/2019 SOA and Web Services Primer
20/71
Web service design methodology
Web services can be written in two ways:
bottom up method
top down method
-
8/6/2019 SOA and Web Services Primer
21/71
Web service design methodology
A developer using the "bottom up method" first writes theimplementing class in a programming language, and thenuses a WSDL generating tool to expose its methods as a web
service. This is often the simpler approach.
-
8/6/2019 SOA and Web Services Primer
22/71
Web service design methodology
A developer using the "top down method" first writesthe WSDL document and then uses a code generatingtool to produce the class skeleton, which he latercompletes.
-
8/6/2019 SOA and Web Services Primer
23/71
SOAP
Simple Object Access Protocol
-
8/6/2019 SOA and Web Services Primer
24/71
SOAP Structure
-
8/6/2019 SOA and Web Services Primer
25/71
SOAP Structure
A SOAP message is encoded as an XML document, consisting of an element, which contains an optional element,and a mandatory element. The element, containedwithin the , is used for reporting errors. The SOAP envelope The SOAP is the root element in every SOAP
message, and contains two child elements, an optional and amandatory .
The SOAP header The SOAP is an optional sub-element of the SOAPenvelope, and is used to pass application-related information that is to beprocessed by SOAP nodes along the message path.
The SOAP body The SOAP is a mandatory sub-element of the SOAPenvelope, which contains information intended for the ultimate recipient ofthe message.
The SOAP fault The SOAP is a sub-element of the SOAP body, which isused for reporting errors.
WSDL
-
8/6/2019 SOA and Web Services Primer
26/71
WSDL
W b S i D i t L
-
8/6/2019 SOA and Web Services Primer
27/71
Web Service Descriptor Language
WSDL is an XML-based language for describing Webservices and how to access them.
WSDL is used to describe Web servicesWSDL is also used to locate Web services
WSDL is a W3C recommendation
WSDL St t
-
8/6/2019 SOA and Web Services Primer
28/71
WSDL Structure
Ab t t d C t
-
8/6/2019 SOA and Web Services Primer
29/71
Abstract and Concrete
An abstract WSDL document describes what the web servicedoes, but not how it does it or how to contact it. Anabstract WSDL document defines:
the operations provided by the web service.
the input, output and fault messages used by each operation tocommunicate with the web service, and their format.
A concrete WSDL document adds the information abouthow the web service communicates and where you canreach it. A concrete WSDL document contains the abstractWSDL definitions, and also defines:
the communication protocols and data encodings used by the webservice.
the port address that must be used to contact the web service.
Th WSDL D t St t
-
8/6/2019 SOA and Web Services Primer
30/71
The WSDL Document Structure
A typical WSDL document consists of the followingelements
Element Defines
Root WSDL element
What datatypes will be transmitted
What message will be transmitted
What operations (functions) will be supported
The communication protocols used by the web service
Where is the service located.
Used to provide human-readable documentation
To import other WSDL documents or XML Schemas
-
8/6/2019 SOA and Web Services Primer
31/71
H t d WSDL
-
8/6/2019 SOA and Web Services Primer
32/71
How to read a WSDL
The root element of a WSDL is definitions. So we startthe WSDL tree with a definition node as root
H t d WSDL (D fi iti )
-
8/6/2019 SOA and Web Services Primer
33/71
How to read a WSDL (Definition)
The definition element specifies that this document isthe HelloService. It also specifies the numerousnamespaces that will be used throughout the
document.The use of namespaces is important for differentiating
elements, and it enables the document referencemultiple external specification. WSDL specification
SOAP specification and
XML schema specification
Ho to read a WSDL (Definition)
-
8/6/2019 SOA and Web Services Primer
34/71
How to read a WSDL (Definition)
The definition element also specifies a targetNamespace
attribute. The targetNamespace is a convention of XMLschema that enables the WSDL document to refer to
itself.
In this example we specifed a targetNamespace ofhttp://www.ecerami.com/wsdl/HelloService.wsdl
Note: the namespace specification does not require that thedoucment actually exist at this location; the important
point is that you specify a value that is unique, different
from all other namespaces that are defined.
How to read a WSDL (Definition)
http://www.ecerami.com/wsdl/HelloService.wsdlhttp://www.ecerami.com/wsdl/HelloService.wsdl -
8/6/2019 SOA and Web Services Primer
35/71
How to read a WSDL (Definition)
The definition element specifies a default namespace:xmlns=http://schemas.xmlsoap.org/wsdl/ .
All the elements without a namespace prefic, such asmessage or porttype, are therefore assumed to bepart of the default WSDL namespace.
How to read a WSDL (Service)
-
8/6/2019 SOA and Web Services Primer
36/71
How to read a WSDL (Service)
To analyze a WSDL document it is recommended to read itfrom the bottom upwards.
At the bottom of the WSDL we find a child element namedservice
How to read a WSDL (Service)
-
8/6/2019 SOA and Web Services Primer
37/71
How to read a WSDL (Service)
A Service may have one or more ports. Each portdescribes a way to access the service.
How to read a WSDL (Service)
-
8/6/2019 SOA and Web Services Primer
38/71
How to read a WSDL (Service)
Its child element address has a different XML prefix thanthe other elements. (soap, soap12, http, etc.,)
How to read a WSDL (Binding)
-
8/6/2019 SOA and Web Services Primer
39/71
How to read a WSDL (Binding)
To move on, we have to look at the binding attribute ofthe port.
How to read a WSDL (Binding)
-
8/6/2019 SOA and Web Services Primer
40/71
How to read a WSDL (Binding)
A binding provides details about a specific transport.
How to read a WSDL (Binding)
-
8/6/2019 SOA and Web Services Primer
41/71
How to read a WSDL (Binding)
The (wsdl:binding> element of the WSDL contains a pairof parameters that influence the form of the resultingSOAP messages :
Binding style (RPC or document) and
Use (encoded or literal)
How to read a WSDL (Binding)
-
8/6/2019 SOA and Web Services Primer
42/71
How to read a WSDL (Binding)
The Style Attribute This choice corresponds to how theSOAP payload i.e., how the contents of the element can be structured.
Document The SOAP message is sent as one document in the element without additional formatting rules havingto be considered. The Document style is the default choice.
RPC The structure of an RPC style element needsto comly with the rules specified in detail in section 7 of the SOAP
1.1 specification. According to these rules, maycontain only one element that is named after the operation, andall parameters myst be represented as sub-elements of thiswrapper elements.
How to read a WSDL (Binding)
-
8/6/2019 SOA and Web Services Primer
43/71
How to read a WSDL (Binding)
SOAP has its roots in synchronous remote procedurecalls over HTTP and the appearance of the documentaccordingly followed these conventions. Later, it wasseen as a simplification to use arbitary XML in the
SOAP body without adhering to conventions.
The choice of one or the other is mainly a question of
personal taste since most SOAP clients today acceptboth versions.
How to read a WSDL (Binding)
-
8/6/2019 SOA and Web Services Primer
44/71
How to read a WSDL (Binding)
The Use Attribute This attribute specifies the encoding rulesof the SOAP message. It refers to the serialization rulesfollowed by the SOAP client and SOAP server to interpret thecontents of the element of the SOAP payload.
Literal Means that the type definitions literally follow an XML schemadefinition.
Encoded refers to the representation of application data in XML,usually according to the SOAP encoding rules of the SOAP 1.1specification. The rules to encode and interpret a SOAP body are in aURL specified by the encodingStyle attribute.
Encoded is the appropriate choice where non-treelike structures areconcerned, because all others can be perfectly described in XMLschema.
How to read a WSDL (Binding)
-
8/6/2019 SOA and Web Services Primer
45/71
How to read a WSDL (Binding)
The combination of the style and use attributes leads tofour possible style/use pairs:
1. RPC/encoded
2. RPC/literal
3. Document/encoded
4. Document/literal
How to read a WSDL (Binding)
-
8/6/2019 SOA and Web Services Primer
46/71
How to read a WSDL (Binding)
In the binding you can find the transport option for theoperation.
Inside the operation element there is a soap:operationelement defining details for the SOAP protocol and itstransport. The soapAction is a reminiscent from thepast and is used with a fixed value of an empty string.
How to read a WSDL (Binding)
-
8/6/2019 SOA and Web Services Primer
47/71
How to read a WSDL (Binding)
Because Web Services set the focus on message not parameters,
information about the transport of these messages can be found in thewsdl:input and wsdl:output element.
A service may specify one or more faults as an alternative for the output.
How to read a WSDL (Binding)
-
8/6/2019 SOA and Web Services Primer
48/71
How to read a WSDL (Binding)
The soap:body and soap:header elements can describe amessage further.
How to read a WSDL (PortType)
-
8/6/2019 SOA and Web Services Primer
49/71
How to read a WSDL (PortType)
Time to move up in the WSDL. Now we follow the value of the type attribute of thebinding. It points to a portType with the same name further up in the document.
Now we have crossed the border from the concrete details about the transport andlocation of a service to its pure abstract description of its interface.
How to read a WSDL (PortType)
-
8/6/2019 SOA and Web Services Primer
50/71
How to read a WSDL (PortType)
PortType is in WSDL 1.1 similar to the interface of theWeb Service.
In WSDL 2.0 the term portType is substituted with the
term interface.
How to read a WSDL (PortType)
-
8/6/2019 SOA and Web Services Primer
51/71
How to read a WSDL (PortType)
An interface can have several operations.
An operation corresponds to a function in procedural programming.
How to read a WSDL (PortType)
-
8/6/2019 SOA and Web Services Primer
52/71
How to read a WSDL (PortType)
Inside a portType we find operation element as in the
binding.
But this time the input and output describe the structure ofthe message not transport specific options
How to read a WSDL (Message)
-
8/6/2019 SOA and Web Services Primer
53/71
How to read a WSDL (Message)
The message attribute of the input refers again up in the
WSDL document.
Further up in the document we find a correspondingmessage with this name
How to read a WSDL (Message)
-
8/6/2019 SOA and Web Services Primer
54/71
How to read a WSDL (Message)
The message element has one part element as child.
A WSDL specialist will recognize the value of the attribute name,parameters indicates the wrapper sub-style
How to read a WSDL (Types)
-
8/6/2019 SOA and Web Services Primer
55/71
How to read a WSDL (Types)
The next child of the definitions element is types
How to read a WSDL (Types)
-
8/6/2019 SOA and Web Services Primer
56/71
How to read a WSDL (Types)
The types element can have multiple XML schema aschildren.
How to read a WSDL (Types)
-
8/6/2019 SOA and Web Services Primer
57/71
How to read a WSDL (Types)
In a schema we can find the definition of : ComplexTypes SimpleTypes
and the declaration of:
Elements
In a document/literal style all the parts point to elements
How to read a WSDL (Types)
-
8/6/2019 SOA and Web Services Primer
58/71
How to read a WSDL (Types)
A complex type with a sequence as content
How to read a WSDL (Types)
-
8/6/2019 SOA and Web Services Primer
59/71
How to read a WSDL (Types)
A sequence consists of several elements that describethe order of elements in a SOAP message.
WSDL operations
-
8/6/2019 SOA and Web Services Primer
60/71
WSDL operations
WSDL supports four basic patterns of operation: One Way
The service receives a message. The operation there has a single inputelement.
Request-responseThe service receives a message and sends a response. The operation
therefore has one input element and one output element. Toencapsulate errors, an optional fault element can be specified.
Solicit-responseThe service sends a message and receives a response. The operation
therefore has one output element, followed by one input element. To
encapsulate errors, an optional fault element can also be specified. Notification
The service sends a message. The operation therefore has a singleoutput element.
WSDL operations
-
8/6/2019 SOA and Web Services Primer
61/71
WSDL operations
ESB
-
8/6/2019 SOA and Web Services Primer
62/71
ESB
Enterprise Service Bus
-
8/6/2019 SOA and Web Services Primer
63/71
Enterprise Service Bus
A Standard based middleware architecture which allowspluggable components to communicate with eachother via a messaging system
Enterprise Service Bus
-
8/6/2019 SOA and Web Services Primer
64/71
p
Use of an ESB certainly implies adherence to a particulararchitecture
The term Enterprise Service Bus" almost always
denotes the software infrastructure that enables suchan architecture.
Enterprise Service Bus
-
8/6/2019 SOA and Web Services Primer
65/71
p
In essence, the ESB is considered a platform to realize aservice-oriented architecture.
Enterprise Service Bus
-
8/6/2019 SOA and Web Services Primer
66/71
p
An Enterprise Service Bus (ESB) brings flow-relatedconcepts such as
Transformation and
Routing
to a Service-Oriented Architecture.
Enterprise Service Bus
-
8/6/2019 SOA and Web Services Primer
67/71
p
Routing In a large enterprise with numerous applications and channels to connect them, a message may have to gothrough several channels to reach its final destination. The route a message must follow may be so complex that theoriginal sender does not know what channel will get the message to the final receiver. Instead, the original sendersends the message to a Message Router, an application component and filter in the pipes-and-filters architecture,which will determine how to navigate the channel topology and direct the message to the final receiver, or at least tothe next router.
Transformation Various applications may not agree on the format for the same conceptual data; the sender formatsthe message one way, yet the receiver expects it to be formatted another way. To reconcile this, the message mustgo through an intermediate filter, a Message Translator, that converts the message from one format to another.
Endpoints An application does not have some built-in capability to interface with a messaging system. Rather, it must
contain a layer of code that knows both how the application works and how the messaging system works, bridgingthe two so that they work together. This bridge code is a set of coordinated Message Endpoints that enable theapplication to send and receive messages.
Enterprise Service Bus
-
8/6/2019 SOA and Web Services Primer
68/71
p
An ESB can also provide an Abstraction for Endpoints.
This promotes flexibility in the Transportation Layer andenables loose coupling and easy connection betweenservices
JBI
-
8/6/2019 SOA and Web Services Primer
69/71
Java Business Integration
-
8/6/2019 SOA and Web Services Primer
70/71
g
Java Business Integration is a Java-based standardaddressing the EAI and B2B issues based on theparadigms and principles advocated by service-
oriented architecture.
The current version (1.0) is finalized through the JSR(Java Specification Request) 208 in August 2005. Both
commercial and open source worlds have alreadystarted embracing JBI as an integration standard intheir ESB products
-
8/6/2019 SOA and Web Services Primer
71/71
Thank you