Loading presentation...

Present Remotely

Send the link below via email or IM

Copy

Present to your audience

Start remote presentation

  • Invited audience members will follow you as you navigate and present
  • People invited to a presentation do not need a Prezi account
  • This link expires 10 minutes after you close the presentation
  • A maximum of 30 users can follow your presentation
  • Learn more about this feature in our knowledge base article

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.

DeleteCancel

Make your likes visible on Facebook?

Connect your Facebook account to Prezi and let your likes appear on your timeline.
You can change this under Settings & Account at any time.

No, thanks

SOAP

No description
by

pooja bafna

on 28 June 2015

Comments (0)

Please log in to add your comment.

Report abuse

Transcript of SOAP

SOAP
SOAP messages
SOAP messages
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">

<soap:Header>
...
</soap:Header>

<soap:Body>
...
<soap:Fault>
...
</soap:Fault>
</soap:Body>

</soap:Envelope>
SOAP and HTTP
Conclusion
SOAP Header Element
SOAP Header element can have following two attributes :-
Actor attribute
:
The message path is defined as a list of SOAP service nodes. Each of these intermediate nodes can perform some processing and then forward the message to the next node in the chain. By setting the Actor attribute, the client can specify the recipient of the SOAP header.
The SOAP actor attribute is used to address the Header element to a specific endpoint.

<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">

<soap:Header>
<m:Trans xmlns:m="http://www.w3schools.com/transaction/"
soap:actor="http://www.w3schools.com/appml/">234
</m:Trans>
</soap:Header>
...
...
</soap:Envelope>
SOAP Header Element
MustUnderstand attribute :-
Indicates whether a Header element is optional or mandatory. If set to true ie. 1 the recipient must understand and process the Header attribute according to its defined semantics, or return a fault.

<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">

<soap:Header>
<m:Trans xmlns:m="http://www.w3schools.com/transaction/"
soap:mustUnderstand="1">234
</m:Trans>
</soap:Header>
...
...
</soap:Envelope>
SOAP Envelop
The envelope changes when SOAP versions change.

The SOAP envelope is specified using the ENV namespace prefix and the Envelope element.

<?xml version="1.0"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://www.w3.org/2001/12/soap-envelope"

SOAP-ENV:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
...
Message information goes here
...
</SOAP-ENV:Envelope>
SOAP

Simple Object Access Protocol

SOAP allows a program running in one kind of operating system to communicate with a program in the same or another kind of an operating system by using HTTP and its Extensible Markup Language (XML) as the mechanisms for information exchange.

It provides data transport for Web services and can exchange complete documents or call a remote procedure.

SOAP can be used for broadcasting a message
SOAP is platform and language independent
SOAP Encoding
SOAP includes a built-in set of rules for encoding data types.
SOAP data types are divided into two broad categories:
scalar types
and
compound types
.

Scalar types
contain exactly one value, such as a last name, price, or product description. SOAP adopts all the built-in simple types specified by the XML Schema specification. This includes strings, floats, doubles, and integers.

Compound types
contain multiple values, such as a purchase order or a list of stock quotes.

Compound types are further subdivided into
arrays
and
structs.
To create an array, you must specify it as an xsi:type of Array. The array must also include an arrayType attribute.

arrayType="xsd:double[10]"
arrayType="xsd:string[5,5]"

The encoding style for a SOAP message is set via the SOAP-ENV:encodingStyle attribute.
SOAP is based on message exchanges.
Messages are seen as
envelopes
where the application encloses the data to be sent.
Envelope
: ( Mandatory ) :- Defines the start and the end of the message.

Header
: ( Optional ) :- contains application-specific information (like authentication, payment, etc) about the SOAP message.

Body
: ( Mandatory ) :- Contains the XML data comprising the message being sent.

Fault
: ( Optional ) :- An optional Fault element that provides information about errors that occurred while processing the message
Conventional distributed applications used communication technologies, e.g., CORBA, DCOM, Java/RMI, based on object RPC(ORPC) protocols for applications to communicate with each other.

Weaknesses

Both ends of the communication link would need to be implemented under the same distributed object model (Java/RMI or CORBA/IIOP)
Difficulty of getting these protocols to work over firewalls or proxy servers,e.g, most firewalls are configured to allow HTTP to pass across, but not IIOP.

SOAP provides a way to communicate between applications running on different operating systems, with different technologies and programming languages.
Inter-Application Communication

Example SOAP Message
SOAP Transport
SOAP Body
The SOAP body is the area of the SOAP message, where the application specific XML data (payload) being exchanged in the message is placed.

<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">

<soap:Body>
<m:GetPrice xmlns:m="http://www.w3schools.com/prices">
<m:Item>Apples</m:Item>
</m:GetPrice>
</soap:Body>

</soap:Envelope>
SOAP Fault Element
The optional SOAP Fault element is used to indicate error messages.

If a Fault element is present, it must appear as a child element of the Body element. A Fault element can only appear once in a SOAP message.

The SOAP Fault element has the following sub elements:
<faultCode>
A text code used to indicate a class of errors.
<faultString>

A text message explaning the error.
<faultActor>

A text string indicating who caused the fault. This is useful if the SOAP message travels through several nodes in the SOAP message path, and the client needs to know which node caused the error. A node that does not act as the ultimate destination must include a faultActor element.
<detail>
An element used to carry application-specific error messages. The detail element can contain child elements, called detail entries.

The faultcode values defined below must be used in the faultcode element when describing faults :-

VersionMismatch
Found an invalid namespace for the SOAP Envelope element.
MustUnderstan
d An immediate child element of the Header element, with the mustUnderstand attribute set to "1", was not understood.
Client
The message was incorrectly formed or contained incorrect information.
Server
There was a problem with the server so the message could not proceed.

SOAP is not tied to any one transport protocol.

SOAP can be transported via SMTP, FTP, IBM's QSeries, or Microsoft Message Queuing (MSMQ).

SOAP requests are sent via an HTTP request and SOAP responses are returned within the content of the HTTP response. While SOAP requests can be sent via an HTTP GET, the specification includes details on HTTP POST only.

SOAP can use GET or POST. With GET,the request is not a SOAP message but the response is a SOAP message, with POST both request and response are SOAP messages (in version 1.2, version 1.1 mainly considers the use of POST).

SOAP uses the same error and status codes as those used in HTTP so that HTTP responses can be directly interpreted by a SOAP module.
The HTTP Protocol

HTTP communicates over TCP/IP. An HTTP client connects to an HTTP server using TCP. After establishing a connection, the client can send an HTTP request message to the server :-
POST /item HTTP/1.1
Host: 189.123.255.239
Content-Type: text/plain
Content-Length: 200
The server then processes the request and sends an HTTP response back to the client.
200 OK
Content-Type: text/plain
Content-Length: 200
The server returned a status code of 200. This is the standard success code for HTTP.
SOAP HTTP Binding
A SOAP method is an HTTP request/response that complies with the SOAP encoding rules.

HTTP + XML = SOAP

A SOAP request could be an HTTP POST or an HTTP GET request.

The HTTP POST request specifies at least two HTTP headers:
Content-Type

and

Content-Length
.

The Content-Type header for a SOAP request and response defines the MIME type for the message and the character encoding (optional) used for the XML body of the request or response.

POST /item HTTP/1.1
Content-Type: application/soap+xml; charset=utf-8

The Content-Length header for a SOAP request and response specifies the number of bytes in the body of the request or response.

POST /item HTTP/1.1
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 250
SOAP Example
A SOAP request :-

POST /InStock HTTP/1.1
Host: www.example.org
Content-Type: application/soap+xml; charset=utf-8
Content-Length: nnn

<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">

<soap:Body xmlns:m="http://www.example.org/stock">
<m:GetStockPrice>
<m:StockName>IBM</m:StockName>
</m:GetStockPrice>
</soap:Body>

</soap:Envelope>
SOAP Example
The SOAP response :-

HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: nnn

<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">

<soap:Body xmlns:m="http://www.example.org/stock">
<m:GetStockPriceResponse>
<m:Price>34.5</m:Price>
</m:GetStockPriceResponse>
</soap:Body>

</soap:Envelope>

Advantages
of SOAP are:
– Simplicity
– Portability
– Firewall friendliness
– Use of open standards
– Interoperability
– Universal acceptance.
Disadvantages
of SOAP are:
– specification contains no mention of security facilities.
– Statelessness
– SOAP clients do not hold any stateful references to remote objects.
By,
Pooja Prakashchand.
Emp ID: 22906958
Full transcript