Session 3_TP 3

fishnibblersspongySoftware and s/w Development

Dec 14, 2013 (3 years and 8 months ago)

76 views

Session 3

Introduction to SOAP

XML Webservices with .Java / Session 3 /
2

of 21


Service Description Language (SDL) is the language
used to describe a service


The language used to describe the services offered
by a Web Service is known as Web Service
Description Language (WSDL).


WSDL is a subset of two separate documents,

NASSL
(Network Accessible Service Specification Language)
and WDS (Well Defined Service document).


An
operation

is an abstract definition of a particular
action supported by the Web Service. A set of input
and output messages collectively defines an
operation.

Review of Session 2 (1 of 2)

XML Webservices with .Java / Session 3 /
3

of 21


types

is a mechanism to define the data types used
in the Web Service. For example, XSD (XML Style
Definition).


binding

specifies a list of communication protocols
and data formats for a particular port type. A
binding specifies the manner in which operations
will access the service using a certain protocol.


A WSDL file can be classified into two sections:


Abstract

Definitions


Concrete

Descriptions


Review of Session 2 (2 of 2)

XML Webservices with .Java / Session 3 /
4

of 21

Objectives


Explain the concept of SOAP protocols


Describe the working of SOAP


Explain the architecture of SOAP messages


Identify and analyze the different parts of a
SOAP message


Explain the Fault element

XML Webservices with .Java / Session 3 /
5

of 21

Communication Rules

Computer A

Computer B

File being transferred from A to B in
DATA PACKETS

FILE

Data Packets

No acknowledgement is sent
back from B to A


A continues to send the data
packets even if B has a
hardware failure


Packets transmitted during this
time are lost

Next packet should be sent only
if acknowledgement for the
previous is received


The rules for communication
are known as Protocols




XML Webservices with .Java / Session 3 /
6

of 21

TCP/IP and HTTP


Fundamental protocol

used for communication
over a computer network

Communicate using TCP/IP

Identified by IP addresses

10.1.2.1

10.1.2.6

HTTP sits over the TCP/IP protocol

HTTP was designed for the Web for transmission of HTML pages

XML Webservices with .Java / Session 3 /
7

of 21

XML and HTTP

XML

is

a

text
-
based

markup

language

XML

can

be

used

with

HTTP

to

communicate

data

between


applications

working

on

different

platforms

TCP/IP

HTTP

XML

XML Webservices with .Java / Session 3 /
8

of 21

SOAP

HTTP

Simple Object Access Protocol

Component A

Component B

Component C

Application A

Application B

XML
-
based,

lightweight

protocol

used

with

HTTP

for

communication

XML Webservices with .Java / Session 3 /
9

of 21

SOAP Client

SOAP Server

Network

HTTP

Packet

1

2

3

4

5

6

2

Working of SOAP

Request

Document

HTTP


Packet

Response

Document

5

XML Webservices with .Java / Session 3 /
10

of 21

An Example of SOAP

XML

Parser

XML

Parser

API

API

Request

Response

Result sent to the
client that had called
the Web Service

Client command
creates action on the
application server

XML Webservices with .Java / Session 3 /
11

of 21

Architecture of SOAP
Messages

SOAP message with

an HTTP packet

SOAP header is optional

PayLoad

Delivery

Information

XML Webservices with .Java / Session 3 /
12

of 21

SOAP Terminology

SOAP Header:
Optional
. Contains header information.

SOAP Body:
Consists of the tags

defined by the method to be

invoked.

SOAP Envelope: This is the
root element

in a SOAP message. It

is wrapped in a transport protocol packet like HTTP. It is XML

encoded and is mandatory in a SOAP message.

XML Webservices with .Java / Session 3 /
13

of 21

SOAP Request Using HTTP (1 of 2)

HTTP header

SOAP body enclosed
in SOAP envelope

XML Webservices with .Java / Session 3 /
14

of 21

SOAP Response Using HTTP (2 of 2)

HTTP header

SOAP body enclosed
in SOAP envelope

XML Webservices with .Java / Session 3 /
15

of 21

HTTP Header

Object Endpoint ID and method identifier

SOAP Envelope

Namespaces for version

and encoding

SOAP Header

Name, namespace, actor

SOAP Message

Element, namespace

SOAP Body

Name, namespace, actor

Element, namespace

XML Webservices with .Java / Session 3 /
16

of 21

HTTP Header

Post /iemfamily/CreditCard.asmx HTTP/1.1

Host:
www.iemfamily.com

Content
-
Type: text/xml; charset=utf
-
8

Content
-
Length: length

HTTP

method used

Target file

HTTP version
specification

Target URL

This is a placeholder and holds
the length of the document

Encoding used

XML Webservices with .Java / Session 3 /
17

of 21

Fault Element


Used

to

transport

error

and

status

information

Must

be

a

body

entry
;


it

can

appear

only

once

Has

four

child

elements

Presence

is

optional

XML Webservices with .Java / Session 3 /
18

of 21

Fault: Child Elements


faultcode
:

Used

by

Web

service

consumer

to


identify

the

fault


faultstring
:

Used

to

provide

description

of



the

fault



faultactor
:

Used

to

identify

the

source

of



the

fault



detail
:

Holds

application
-
specific

error



information


XML Webservices with .Java / Session 3 /
19

of 21

Merits of SOAP

Built

upon

open

technologies

like

HTTP

and

XML
.

This

facilitates

interoperability

between

applications
.

Not

bound

with

any

transport

protocol
.

Hence,

flexible
.

Works

with

any

application

that

accesses

port

80

for

HTTP

requests

and

responses
.

Encourages

distributed

computing
.

Changes

in

SOAP

specification

will

not

cause

major

changes

in

applications
.


XML Webservices with .Java / Session 3 /
20

of 21

Demerits of SOAP

Simply

a

wire

protocol

and

not

a

complete

distributed

architecture

Does

not

account

for

security

in

distributed

computing

environment

Remote

garbage

collection

not

supported

Storing

the

state

of

a

remote

object

is

not

supported

if

HTTP

is


used

as

the

underlying

protocol

Performance

is

poor

as

compared

to

other

contemporary

wire

protocols


XML Webservices with .Java / Session 3 /
21

of 21

Summary


XML can be used with HTTP for communication amongst
applications working on different platforms, giving a solution to
the interoperability problem.


SOAP is an XML
-
based protocol, which allows components, and
applications to communicate using HTTP.


A SOAP message consists of a mandatory SOAP envelope, a
mandatory SOAP body and an optional SOAP header.


The namespace identifier for the attributes and elements
defined in a SOAP envelope is
http://schemas.xmlsoap.org/envelope/.


Remote garbage collection is not supported by SOAP.


The SOAP
Fault

element is used to transport error or status
information or both, within a SOAP message.


The first “new” layer added by SOAP is the element
-
normal
-
form encoding style described SOAP specification.