1 / 21

.NET and SOAP

.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.

jean
Download Presentation

.NET and SOAP

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

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

  3. 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

  4. 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.

  5. SOAP Message Format

  6. 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>

  7. 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>

  8. 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

  9. 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>

  10. 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>

  11. 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>

  12. 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.

  13. HTTP Request POST /StockQuote HTTP/1.1 Host: www.stockquoteserver.com Content-Type: text/xml; charset="utf-8" Content-Length: nnnn SOAPAction: "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>

  14. HTTP Response HTTP/1.1 200 OK Content-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>

  15. 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.

  16. 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>

  17. 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

  18. 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.

  19. 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>

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

  21. 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.

More Related