net and soap
DESCRIPTION
.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. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: NET and SOAP](https://reader036.vdocuments.us/reader036/viewer/2022062723/56813c64550346895da5efd3/html5/thumbnails/1.jpg)
.NET and SOAP
An Overview of SOAP
By Raghavendra Aekka
![Page 2: NET and SOAP](https://reader036.vdocuments.us/reader036/viewer/2022062723/56813c64550346895da5efd3/html5/thumbnails/2.jpg)
Overview
Introduction SOAP Message format SOAP Request SOAP response SOAP Data types SOAP-HTTP binding SOAP-RPC SOAP Fault Element Conclusion
![Page 3: NET and SOAP](https://reader036.vdocuments.us/reader036/viewer/2022062723/56813c64550346895da5efd3/html5/thumbnails/3.jpg)
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
![Page 4: NET and SOAP](https://reader036.vdocuments.us/reader036/viewer/2022062723/56813c64550346895da5efd3/html5/thumbnails/4.jpg)
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.
![Page 5: NET and SOAP](https://reader036.vdocuments.us/reader036/viewer/2022062723/56813c64550346895da5efd3/html5/thumbnails/5.jpg)
SOAP Message Format
![Page 6: NET and SOAP](https://reader036.vdocuments.us/reader036/viewer/2022062723/56813c64550346895da5efd3/html5/thumbnails/6.jpg)
SOAP Request<SOAP-ENV:Envelope xmlns:SOAP-ENV=“http://schemas.xmlsoap.org/soap/envelope/SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/”> <SOAP-ENV:Header> <t:transId xmlns:t=“http://a.com/trans”>345</t:transId> </SOAP-ENV:Header> <SOAP-ENV:Body> <m:Add xmlns:m=“http://a.com/Calculator”> <n1>3</n1> <n2>4</n2> </m:Add> </SOAP-ENV:Body></SOAP-ENV:Envelope>
![Page 7: NET and SOAP](https://reader036.vdocuments.us/reader036/viewer/2022062723/56813c64550346895da5efd3/html5/thumbnails/7.jpg)
SOAP Response
<SOAP-ENV:Envelope
xmlns:SOAP-ENV=“http://schemas.xmlsoap.org/soap/envelope/”
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/”>
<SOAP-ENV:Header>
<t:transId xmlns:t=“http://a.com/trans”>345</t:transId>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<m:AddResponse xmlns:m=“http://a.com/Calculator”>
<result>7</result>
</m:AddResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
![Page 8: NET and SOAP](https://reader036.vdocuments.us/reader036/viewer/2022062723/56813c64550346895da5efd3/html5/thumbnails/8.jpg)
SOAP Data types
Types are either simple (scalar) or compoundwhich 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
![Page 9: NET and SOAP](https://reader036.vdocuments.us/reader036/viewer/2022062723/56813c64550346895da5efd3/html5/thumbnails/9.jpg)
Simple Type Example
<element name="age" type="int"/><element name="height" type="float"/><element name="displacement" type="negativeInteger"/><element name="color"> <simpleType base="xsd:string"> <enumeration value="Green"/> <enumeration value="Blue"/> </simpleType></element>
![Page 10: NET and SOAP](https://reader036.vdocuments.us/reader036/viewer/2022062723/56813c64550346895da5efd3/html5/thumbnails/10.jpg)
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
<e:Book>
<author> William Shakespeare</author>
<Title> The Tempest</Title>
</e:Book>
![Page 11: NET and SOAP](https://reader036.vdocuments.us/reader036/viewer/2022062723/56813c64550346895da5efd3/html5/thumbnails/11.jpg)
Array type A compound value in which ordinal position serves as
the only distinction among member values.
<SOAP-ENC:Array SOAP-ENC:arrayType="xyz:Order[2]"> <Order> <Product>Apple</Product> <Price>1.56</Price> </Order> <Order> <Product>Peach</Product> <Price>1.48</Price> </Order></SOAP-ENC:Array>
![Page 12: NET and SOAP](https://reader036.vdocuments.us/reader036/viewer/2022062723/56813c64550346895da5efd3/html5/thumbnails/12.jpg)
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.
![Page 13: NET and SOAP](https://reader036.vdocuments.us/reader036/viewer/2022062723/56813c64550346895da5efd3/html5/thumbnails/13.jpg)
HTTP RequestPOST /StockQuote HTTP/1.1Host: www.stockquoteserver.comContent-Type: text/xml; charset="utf-8"Content-Length: nnnnSOAPAction: "GetLastTradePrice“
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body><m:GetLastTradePrice xmlns:m="Some-URI"><symbol>DIS</symbol></m:GetLastTradePrice></SOAP-ENV:Body></SOAP-ENV:Envelope>
![Page 14: NET and SOAP](https://reader036.vdocuments.us/reader036/viewer/2022062723/56813c64550346895da5efd3/html5/thumbnails/14.jpg)
HTTP ResponseHTTP/1.1 200 OKContent-Type: text/xml; charset="utf-8"Content-Length: nnnn
<SOAP-ENV:Envelope xmlns:SOAP-ENV= "http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle= “http://schemas.xmlsoap.org/soap/encoding/"/> <SOAP-ENV:Body> <m:GetLastTradePriceResponse xmlns:m="Some-URI"> <Price>34.5</Price> </m:GetLastTradePriceResponse> </SOAP-ENV:Body></SOAP-ENV:Envelope>
![Page 15: NET and SOAP](https://reader036.vdocuments.us/reader036/viewer/2022062723/56813c64550346895da5efd3/html5/thumbnails/15.jpg)
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 todo RPC using SOAP Areduced, RPC-based view of the SOAP
message. Only the body portions of the SOAP request and response envelopes are shown.
![Page 16: NET and SOAP](https://reader036.vdocuments.us/reader036/viewer/2022062723/56813c64550346895da5efd3/html5/thumbnails/16.jpg)
Request <SOAP-ENV:Body> <m:GetLastTradePrice xmlns:m="some-URI"> <symbol>DEF</Symbol> </m:GetLastTradePrice></SOAP-ENV:Body>
Response <SOAP-ENV:Body> <m:GetLastTradePriceResponse xmlns:m="some-URI"> <price>22.50</price> </m: GetLastTradePriceResponse></SOAP-ENV:Body>
![Page 17: NET and SOAP](https://reader036.vdocuments.us/reader036/viewer/2022062723/56813c64550346895da5efd3/html5/thumbnails/17.jpg)
SOAP Fault ElementUsed to carry error and/or status information within a
SOAP messageAppears 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
![Page 18: NET and SOAP](https://reader036.vdocuments.us/reader036/viewer/2022062723/56813c64550346895da5efd3/html5/thumbnails/18.jpg)
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.
![Page 19: NET and SOAP](https://reader036.vdocuments.us/reader036/viewer/2022062723/56813c64550346895da5efd3/html5/thumbnails/19.jpg)
SOAP Fault example<SOAP-ENV:Envelope xmlns:SOAP-ENV=“http://schemas.xmlsoap.org/soap/envelope/”
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/”>
<SOAP-ENV:Body> <SOAP-ENV:Fault> <faultcode>SOAP-ENV:Server</faultcode> <faultstring>Internal Application Error</faultstring> <detail xmlns:f=“http://www.a.com/CalculatorFault”> <f:errorCode>794634</f:errorCode> <f:errorMsg>Divide by zero</f:errorMsg> </detail> </SOAP-ENV:Fault> </SOAP-ENV:Body></SOAP-ENV:Envelope>
![Page 20: NET and SOAP](https://reader036.vdocuments.us/reader036/viewer/2022062723/56813c64550346895da5efd3/html5/thumbnails/20.jpg)
SOAP Implementations
Apache SOAP
Open source, based on IBM SOAP4J
Microsoft SOAP toolkit COM implementation, for COM-compliant
languages
SOAP::Lite for Perl
![Page 21: NET and SOAP](https://reader036.vdocuments.us/reader036/viewer/2022062723/56813c64550346895da5efd3/html5/thumbnails/21.jpg)
ConclusionSOAP 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 toresolve problems of data representation and serialization.