Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

SOAP--Simple Object Access Protocol


Published on

The slides provide a major overview on SOAP protocol, and demonstrates a working example that uses SOAP for RPC. It uses WCF/visual studio and Apache Axis for the implementation.

Published in: Education
  • Be the first to comment

SOAP--Simple Object Access Protocol

  1. 1. SOAP: SIMPLE OBJECT ACCESS PROTOCOL Mohammad Masudur Rahman Software Research Lab, Department of Computer Science University of Saskatchewan CMPT 842: Mobile & Cloud Computing
  2. 2. SOAP (3 TYPES) 2 Commodity TV Show (1977) Communication Protocol (1999) SOAP = Simple Object Access Protocol
  3. 3. WEB SERVICE & SOAP  Web Application (Web App)  Web application is a client-server software application in which the client runs in a web browser.  Web Service (WS)  A software system to support interoperable machine-to- machine interaction over a network (W3C)  Web Service Description Language (WSDL)  XML based specification of a web service.  Simple Object Access Protocol (SOAP)  An XML based communication protocol for web service over HTTP or SMTP.  Interoperability  Having clear interface by a system for communication with other information systems. 3
  4. 4. OUTLINE OF TALK 4 Web Service Overview Architecture History & Evolution REST SOAP Overview History Specification Example Security Contrast Tools
  5. 5. WEB SERVICE (WS)  Web service is a component of web application.  A type of Application Programming Interface (API) that operates over HTTP or SMTP  Targets machine-to-machine communication using clear service specifications.  Follows XML-based protocols: SOAP/XML-RPC  Follows JSON based protocols: REST, also called Web API (growing popularity).  Uses WSDL/WADL and UDDI for service publishing  Basically useful for business communication, and reuse of legacy systems. 5
  6. 6. HISTORY OF WEB SERVICE  1994--97: HTTP, TCP/IP as mainstream business/communication protocol in the web.  1998: XML 1.0 standardization by W3C  1998: XML-RPC (SOAP) by Dave Winer, Userland Software & Microsoft.  1999: SOAP 1.0 by Mircosoft, demoed to IBM.  2000: SOAP 1.1 in cooperation with IBM.  May, 2000: SOAP 1.1 submitted to W3C  Fall, 2000: WSDL 1.0 announced (MSFT+IBM)  March, 2001: WSDL submitted to W3C  September, 2000: UDDI 1.0 announced (Microsoft +Arriba)  December, 2000: Oracle, HP, Sun, IBM & Microsoft committed to web services. 6 Source: Source:
  7. 7. EVOLUTION OF WEB SERVICE (MICROSOFT PERSPECTIVE)  Component Object Model (COM)  Reuse of components from various languages  Windows service, Microsoft Office family, Media Foundation  Distributed Component Object Model (DCOM)  Remote method invocations using COM  Dot Net Remoting  Software as a service, using TcpChannels, Legacy reuse  Web Service  Distributed application using SOAP, HTTP, & XML  Window Communication Foundation (WCF)  Improves WS, targets SOA, adds JSON, REST 7 Source:
  8. 8. WEB SERVICE ARCHITECTURE BY W3C (SOAP-BASED) 8 Discovery Agency Service Provider Service Requestor Service Service Description (WSDL) Publish Find Ref: Service Description (WSDL) Client Interact SOAP UDDI UDDI = Universal Description, Discovery, and Integration [ ] • 3 Parties • 2 Components • 3 Actions
  9. 9. WEB SERVICE ARCHITECTURE (REST-BASED) 9 Discovery Agency Service Provider Service Requestor Service Service Description (WADL) Publish Find Ref: Service Description (WADL) Client Interact REST UDDI
  10. 10. TOOLS FOR UDDI (PUBLISH/FIND)  UDDI4J: Open source tool for Java  Systinet: UDDI client library  Apache Scout: Apache JAXR based  Apache jUDDI: Wrapper on Scout + extra  UDDI4r: Ruby implementation for UDDI  UDDI Lite  UDDI4Py: For Python by IBM  Ruddi: Open source, Java-based  Eclipse & Visual Studio: Built-in support. 10 Source:
  11. 11. OUTLINE OF TALK 11 Web Service Overview Architecture History & Evolution REST SOAP Overview History Specification Example Security Contrast Tools
  12. 12. SIMPLE OBJECT ACCESS PROTOCOL (SOAP)  An XML-based protocol for accessing web service.  A messaging protocol among web applications.  Defines a set of rules for structuring messages passed among application over internet.  Not tied to any OS or programming language.  Not tied to any protocol, but mostly used with HTTP & SMTP for their popularity  Analogous to RPC in DCOM, CORBA, RMI  Created by Dave Winer, Userland Software & Microsoft.  W3C recommendation since June 24, 2003 12
  13. 13. AN EXAMPLE USE-CASE (SOAP)  Simple web service to offer employee information within an organization, can be diverse like AWS.  Service module accesses Employee database.  Client ↔ Listener communicates using SOAP.  Client encodes request as a SOAP request.  Listener decodes the request, and collect results from the service methods.  Listener encodes the result as a SOAP response. 13 Employee database
  14. 14. EVOLUTION HISTORY (SOAP)  1998: Development of SOAP started, no standard schema for XML. Supported limited data types.  1999: SOAP 1.0 announced by Dave Winer & Microsoft. Not submitted to W3C, but IBM.  2000: SOAP 1.1 announced by MSFT & IBM, still a widely used version.  Based on XML 1.0  Fault Codes.  Mass vendor supports, E-Speak (1999) by HP didn’t get that.  2007: SOAP 1.2 by XML Protocol Working Group  Based on XML Infoset >> XML 1.0  Better interoperability  Truly protocol independent  Formalized extensibility  Better support of web standards, internationalization. 14
  15. 15. WSDL FILE (FOUR ELEMENTS) 15 Types: XML data types for all input and output messages in the service Message: Defines the input & output parameters for each operation PortType: Operations (functions) offered by the web service Binding: Defines protocol and data format for each port type
  16. 16. WSDL FILE EXAMPLE (SCARY !!) 16 Unreadable!
  17. 17. WSDL FILE EXAMPLE (TREE VIEW) 17 Types Message Port Type Binding Service endpoint
  18. 18. SOAP MESSAGE (FOUR ELEMENTS) 18 Envelope Header Body Fault Encoding Fig: SOAP message skeleton Source:
  19. 19. EXAMPLE SOAP REQUEST 19 RPC parameters • GetFactorial (method name) • number = 8 (method parameter) Optional header Fig: SOAP Request example
  20. 20. EXAMPLE SOAP RESPONSE 20 Fig: SOAP Response example RPC response • GetFactorial Response • GetFactorialResult , 8!=40320
  21. 21. HTTP + SOAP REQUEST 21 HTTP Post + Headers SOAP request Fig: SOAP on top of HTTP
  22. 22. WEB SERVICE SECURITY (WS-SECURITY)  An extension of SOAP by OASIS to apply security to web services.  SOAP depends of HTTP, TCP/IP, that provides transport layer security.  WS-Security provides application layer security  Focus: message integrity, confidentiality, and sender’s identity.  Based on XML Signature & XML Encryption  Adds security features in SOAP message header.  Applies X.509, Kerberos, SAML, UserID/password. 22
  23. 23. SECURED SOAP MESSAGE 23 Fig: Secured SOAP request User credentials for authentication & authorization  Payload increases when Signature & Encryption added.  Hampers overall performance significantly
  24. 24. MESSAGE TRANSMISSION OPTIMIZATION MECHANISM (MTOM)  Provides optimization support for sending attachments: Images, PDF, Docs.  Applies to XML Base64Binary data  SOAP envelopes only contain reference to attachment, less message.  XOP = XML-binary Optimized Packaging 24
  25. 25. WEB SERVICE SPECIFICATIONS  Messaging Specification  SOAP  SOAP-over-UDP : SOAP using UDP  SOAP MTOM: Message optimization  WS-Addressing: Message routing  Meta Data Exchange Specifications  WS-Policy: Security/policy advertisement  WSDL, UDDI: Service discovery  WS-Resource Framework: Stateful capabilities  Security Specifications  WS-Signature: Message integrity  WS-Encryption: Message confidentiality  XML Key Management (XKMS): For security purposes.  WS-Trust : Renewing/validating security tokens 25 Source:
  26. 26. SOAP VS. REST Aspect SOAP REST Stands for Simple Object Access Protocol Representational State Transfer What? It’s a protocol It’s an architectural style Use -- SOAP cannot use REST REST might use SOAP Coupling + Clear interfaces, tightly coupled with server Less coupled, client works like a browser Platform + Platform independent Requires HTTP Bandwidth -- Cost more, slower Cost less, faster Media type -- XML only, verbosity issue JSON, plain text, XML Security + SSL + WS-Security Only SSL Maturity + Matured Less matured Message size -- Bigger Light weight, mobile computing Error-handling + Built-in User’s responsibility Sources:, 27
  27. 27. SOAP IMPLEMENTATIONS AVAILABLE 27 Tool Platform Protocols Used Apache Axis Java/C++ SOAP, WSDL Apache Axis 2 Java SOAP 1.1, SOAP 1.2, WSDL, WSDL 2.0, REST, MOTM Apache CXF Java SOAP 1.1, SOAP 1.2, WSDL, WSDL 2.0, REST, MOTM .Net Framework C#/ SOAP, WSDL, MOTM WCF .NET/C# SOAP, WSDL, REST gSOAP C/C++ SOAP 1.1, SOAP 1.2, WSDL, WSDL 2.0, REST, MOTM, JSON WSO2 WSF/PHP PHP SOAP, WSDL Zend Framework PHP SOAP, JSON, JSON-RPC, REST, XML-RPC CodeIgniter PHP XML-RPC XML Interface for Network Service Java SOAP, XML-RPC, WSDL, JSON-RPC, JSON [ MOTM = Message Transmission Optimization Mechanism, WCF = Windows Communication Foundation ]
  29. 29. EXAMPLE DEMONSTRATION (WCF SERVICE)  Name: MathUtilService  Implements IMathUtilService interface/contract  WCF-based web service using Visual Studio 2012  Uses SOAP, WSDL  3 Functions:  GetFactorial(n): returns factorial of a number  IsPrime(n): determines if a number is prime or not.  GetCombination(n, r): returns nCr  Implemented in C#, runs in localhost.  Generates a WSDL: http://localhost:50785/MathUtilService.svc?singleWsdl 29
  30. 30. EXAMPLE DEMONSTRATION (C# CLIENT)  Name: MathUtilClient-CS  Service WSDL can be to the project as a reference.  VS creates stub classes from WSDL specifications automatically.  Service end-points are automatically added to app.config file.  Now, it looks like a local object call  Doesn’t need to think of SOAP/WSDL/REST anything 30
  31. 31. EXAMPLE DEMONSTRATION (JAVA, AXIS2)  Name: MathUtilClient-Java  Done on Eclipse IDE Kepler 4.0  Needs Eclipse Java Web Developer Tools  Axis  Xml_rpc  Saaj  Javax_wsdl  Commons-discovery  Apache-commons-logging  Creates stub classes from WSDL similarly  No need to worry about SOAP, WSDL 31
  32. 32. EXAMPLE DEMONSTRATION (JAVA, RAW SOAP)  Name: MathUtilClientRaw  Used javax.xml.soap library  Sent SOAPMessage as request  Received SOAPMessage as response.  Implemented for GetFactorial(n).  Demonstrates platform-independence & interoperability. 32
  33. 33. THANK YOU!! 33 Mohammad Masudur Rahman Call me Masud Software Research Lab, U of S