.NET and SOAP An Overview of SOAP By Raghavendra Aekka

Download Report

Transcript .NET and SOAP An Overview of SOAP By Raghavendra Aekka

.NET and SOAP

An Overview of SOAP

By Raghavendra Aekka

Overview

Introduction SOAP Message format SOAP Request SOAP response SOAP Data types SOAP-HTTP binding SOAP-RPC SOAP Fault Element Conclusion

Introduction

SOAP is an XML-based protocol for exchanging information between computers.

Primary focus of SOAP is Remote Procedure Calls transported via HTTP.

SOAP is platform and language independent as it is entirely written in XML.

For example, a SOAP Java client running on Linux or a Perl client running on Solaris can connect to a Microsoft SOAP server running on Windows 2000

SOAP Contains Four Parts:

The SOAP envelope construct Defines an overall framework to express what is in a message, who should deal with it, and whether it is optional or mandatory.

The SOAP encoding rules Defines a serialization mechanism that can be used to exchange instances of application-defined datatypes.

The SOAP RPC representation Defines a convention that can be used to represent remote procedure calls and responses.

The SOAP binding Defines a convention to exchange SOAP envelopes between peers using an underlying protocol for transport.

SOAP Message Format

SOAP Request

SOAP Response

SOAP Data types

Types are either simple (scalar) or compound which is a composite of several parts

Simple Type

A "simple type" is a class of simple values SOAP uses all the types found in the section "Built-in data types" of XML Schema A simple value is represented as character data, that is, without any sub-elements

Simple Type Example

• • •

Compound type

A “compound” type is a class of compound values Each related value is potentially distinguished by a role name, ordinal or both (accessor) Supports traditional types like structs and arrays

Struct Type

A compound value in which accessor name is the only distinction among member values, and no accessor has the same name as any other William Shakespeare The Tempest

Array type

A compound value in which ordinal position serves as the only distinction among member values.

Apple 1.56 Peach 1.48

SOAP-HTTP

A binding of SOAP to a transport protocol is a description of how a SOAP message is to be sent using that transport protocol The typical binding for SOAP is HTTP 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 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.

HTTP Request

POST /StockQuote HTTP/1.1

Host: www.stockquoteserver.com

Content-Type: text/xml; charset="utf-8" Content-Length: nnnn SOAPAction: "GetLastTradePrice“ DIS

HTTP Response

HTTP/1.1 200 OK Content-Type: text/xml; charset="utf-8" Content-Length: nnnn 34.5

SOAP-RPC

SOAP messages are basically one-way transmissions from a sender to a receiver. However they are often combined to implement request/response mechanisms. A few conventions must be followed to do RPC using SOAP Areduced, RPC-based view of the SOAP message. Only the body portions of the SOAP request and response envelopes are shown.

Request DEF Response 22.50

SOAP Fault Element

Used to carry error and/or status information within a SOAP message Appears within the SOAP body Defines the following:

faultcode (mandatory)

algorithmic mechanism for identifying the fault defined in the SOAP spec

Faultstring (mandatory)

human readable explanation of the fault

SOAP Fault…

faultactor (optional)

information about who caused the fault to happen URI value identifying the source

Detail

error information related only to the Body element. If not present then indicates that the fault is not related to the Body element.

SOAP Fault example

SOAP Implementations Apache SOAP Open source, based on IBM SOAP4J Microsoft SOAP toolkit COM implementation, for COM-compliant languages SOAP::Lite for Perl

Conclusion

SOAP provides a basic mechanism for: encapsulating messages into an XML document.

mapping the XML document with the SOAP message into an HTTP request.

transforming RPC calls into SOAP messages.

SOAP takes advantage of the standardization of XML to resolve problems of data representation and serialization.