SlideShare a Scribd company logo
‫أكاديمية الحكومة اإللكترونية الفلسطينية‬
            The Palestinian eGovernment Academy
                               www.egovacademy.ps




                               Tutorial III:
Process Integration and Service Oriented Architectures


                           Session 7
                            SOAP

                               Prepared By

                        Mohammed Aldasht

                                 Reviewed by
     Prof. Marco Ronchetti and Prof. Paolo Bouquet, Trento University, Italy
                                  PalGov © 2011                                1
About

This tutorial is part of the PalGov project, funded by the TEMPUS IV program of the
Commission of the European Communities, grant agreement 511159-TEMPUS-1-
2010-1-PS-TEMPUS-JPHES. The project website: www.egovacademy.ps
Project Consortium:
             Birzeit University, Palestine
                                                           University of Trento, Italy
             (Coordinator )


             Palestine Polytechnic University, Palestine   Vrije Universiteit Brussel, Belgium


             Palestine Technical University, Palestine
                                                           Université de Savoie, France

             Ministry of Telecom and IT, Palestine
                                                           University of Namur, Belgium
             Ministry of Interior, Palestine
                                                           TrueTrust, UK
             Ministry of Local Government, Palestine


Coordinator:
Dr. Mustafa Jarrar
Birzeit University, P.O.Box 14- Birzeit, Palestine
Telfax:+972 2 2982935 mjarrar@birzeit.eduPalGov © 2011
                                                                                                 2
© Copyright Notes
Everyone is encouraged to use this material, or part of it, but should properly
cite the project (logo and website), and the author of that part.


No part of this tutorial may be reproduced or modified in any form or by any
means, without prior written permission from the project, who have the full
copyrights on the material.




                   Attribution-NonCommercial-ShareAlike
                                CC-BY-NC-SA

This license lets others remix, tweak, and build upon your work non-
commercially, as long as they credit you and license their new creations
under the identical terms.

                                    PalGov © 2011                                 3
Tutorial Map



           Intended Learning Objectives
A: Knowledge and Understanding
                                                                                    Title                    T    Name
 3a1: Demonstrate knowledge of the fundamentals of middleware.
 3a2: Describe the concept behind web service protocols.
                                                                     Session0: Syllabus and overview         0   Aldasht
 3a3: Explain the concept of service oriented architecture.          Sesson1: Introduction to SOA            2   Aldasht
 3a4: Explain the concept of enterprise service bus.                 Session2: XML namespaces & XML schema   2   Aldasht
 3a5: Understanding WSDL service interfaces in UDDI.                 Session 3: Xpath & Xquery               4   Romi
B: Intellectual Skills                                               Session4: REST web services             3   M. Melhem
 3b1: Design, develop, and deploy applications based on Service      Session5: Lab2: Practice on REST        3   M. Melhem
 Oriented Architecture (SOA).                                        Session 6: SOAP                         2   Aldasht
 3b2: use Business Process Execution Language (BPEL).                Session 7: WSDL                         3   Aldasht
 3b3: using WSDL to describe web services.
                                                                     Session8: Lab 3: WSDL practice          3   Aldasht
C: Professional and Practical Skills                                 Session9: ESB                           4   Aldasht
 3c1: setup, Invoke, and deploy web services using integrated
                                                                     Session10: Lab4: Practice on ESB        4   Aldasht
 development environment.
                                                                     Session11: integration patterns         4   M. Melhem
 3c2: construct and use REST and SOAP messages for web
 services communication.                                             Session12: Lab5: integration patterns   4   M. Melhem
D: General and Transferable Skills                                   Session13: BPEL                         3   Aldasht
 d1: Working with team.                                              Session14: Lab6: Practice on BPEL       3   Aldasht
 d2: Presenting and defending ideas.                                 Session15: UDDI                         2   Aldasht
 d3: Use of creativity and innovation in problem solving.
 d4: Develop communication skills and logical reasoning abilities.
Session 7: SOAP protocol
                        Session ILOs
After completing this module students will be able to discuss
   the:
1. Construction of SOAP messages for web services
     communication
2. Use SOAP messages for web services communication
Session Outlines

  Introduction
      History, definition and basic role
      characteristics
    SOAP Message format
    SOAP section 5 encoding
    SOAP communication styles
    Summary
Introduction: History


• Microsoft started thinking about XML-based
  distributed computing in 1997 to enable applications to
  communicate via RPCs [1].
• In 2000, the XML Protocol working group at the W3C
  was formed to design the XML protocol “core of
  XML-based distributed computing”.
• The group started with SOAP 1.1 as a first working
  draft, then SOAP 1.2 in 2003
SOAP is based on XML concepts




        Web Services Application Code

                  SOAP API

                    SOAP

      XML / XML namespace / XML Schema

                  Source, [6]
Introduction: Definition

• Simple Object Access Protocol (SOAP):
  – An XML-based protocol specification for exchanging
    structured information in the implementation of Web
    Services [2].
• SOAP relies on other Application Layer protocols,
  most notably RPC and HTTP for message negotiation
  and transmission.
• SOAP can form the foundation layer of a web services
  protocol stack
• It provides a basic messaging framework upon which
  web services can be built.
SOAP basic Role

• The role of SOAP [1]:
  – A Web service is a software system designed to support
    interoperable machine-to-machine interaction.
  – A Web service has an interface described in a machine
    processable format (specifically WSDL).
  – Other systems interact with the Web service in a manner
    prescribed by its description using SOAP-messages,
    typically conveyed using HTTP with an XML serialization
    in conjunction with other Web related standards.
SOAP Characteristics


• Provides a mechanism for defining the unit of communication
  using identifiable SOAP message.
• Provides a processing model:
   – A set of rules for dealing with SOAP messages in software which is
     the key to use the protocol successfully.
• Provides an extensibility model: using any number of SOAP
  headers to implement arbitrary extensions on top of SOAP.
SOAP Characteristics, cont.

• Provides a mechanism for error handling
• Provides a flexible mechanism for data representation (text,
  XML, …)
• Provides a convention for representing Remote Procedure Calls
  (RPCs) and responses as SOAP messages
• Provides a protocol binding framework: an architecture for
  building bindings to send and receive SOAP messages over
  arbitrary underlying transports, HTTP, TCP, UDP, ….
Session Outlines

  Introduction
      History, definition and basic role
      characteristics
    SOAP Message format
    SOAP section 5 encoding
    SOAP communication styles
    Summary
SOAP Message format

• SOAP messages are XML instances consisting of [6]:
  – Envelope: a mandatory top element represents the SOAP
    message and provide a container for header and body.
  – Header: an optional element offers a way to pass additional
    processing or control info.
     • Could convey authentication, QoS and service billing data, and
       extra header entries.
     • If present, it must be the first immediate child.
  – Body: a mandatory element carries all mandatory info “body
    entries” for the final recipient
SOAP Message format




SOAP message                        Envelope               Mandatory
Containment Structure.
Source, [6]                  0..1              1           Optional

                                                           Containment
                                                           relationship
                         Header                    Body

                         n                         n
                     “Header                   “Body
                        “Header                   “Body
                      entry”                   Entry”
                         entry”                   Entry”
SOAP message Embedded in HTTP Request
 for GetMyAgeInDays Service
POST /WebSite2/Service.asmx HTTP/1.1
Host: localhost
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/GetMyAgeInDays"
<?xml version="1.0" encoding="utf-8"?>
 <soap:Envelope
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
   xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
 <soap:Body>
 <GetMyAgeInDays xmlns="http://tempuri.org/">
   <day>int</day>
   <month>int</month>
   <year>int</year>
   </GetMyAgeInDays>
 </soap:Body>
</soap:Envelope>
SOAP Message Embedded in HTTP
  Response for GetMyAgeInDays Service

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
 <soap:Body>
   <GetMyAgeInDaysResponse xmlns="http://tempuri.org/">
     <GetMyAgeInDaysResult>int</GetMyAgeInDaysResult>
   </GetMyAgeInDaysResponse>
 </soap:Body>
</soap:Envelope>
SOAP message Example

           <soap-env:Envelope
              xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"
              xmlns:xsd="http://www.w3.org/2001/Schema"
              xmlns:xsi="http://www.w3.org/2001/Schema-instance">
              <soap-env:Header> <!-- optional -->
Header Entry        <cXP:priority
                    xmlns:cXP=“http://companyx.com/ns/priority”
                    soap-env:mustUnderstand=“1”>
                                                          Header Must be processed
                    high
                    </cXP:priority>
                                                          Method
              </soap-env:Header>                                              Use SOAP
                                                        invocation
              <soap-env:Body>                                                 encoding
Body Entry
              <cX:getPhoneNumebr
              xmlns:cX=“http://companyx.com/ns/employees”
              soap-env:encodingStyle=“http://schemas.xmlsoap.org/soap/encoding/”>
  Method            <first-name xsi:type=“xsd:string”>Ahmad</first-name>
 Parameters         <last-name xsi:type=“xsd:string”>Ahmad</last-name>
              </cX:getPhoneNumber>
              </soap-env:Body>         Method Parameter       Method Parameter
           </soap-env:Envelope>              type                   value



                                Source, [6]
SOAP Message Delivery



• SOAP messages may be handed over from a WS requester to a
  service provider via intermediaries.
• Similar to service providers, intermediaries are identified also
  via URI value.
• For example, when embedding SOAP into HTTP, the URI
  maps to the HTTP request URL.
SOAP Message Attributes

• encodingStyle: indicates the serialization rules used in the
  message.
   – Serialization is converting from an application-specific data representation
     to the wire format.
   – While, deserialization is converting back to the original format.
   – Also, called marshalling and unmarshalling.
   – Identified through URI in a body entry and applied until another
     encodingStyle attribute appears in the body element e.g.
     http://schemas.xmlsoap.org/soap/encoding/
SOAP Message Attributes, cont.

• actor: identifies the application that should process the
  header entry.
  e.g. http://schemas.xmlsoap.org/soap/actor/next
• mustUnderstand: identifies whether a SOAP message
  receiver “target actor” must understand ,value „1‟, the
  content of a header entry.
SOAP Message Body Entries

• Recipient must understand and process all body entries.
• Body entries are specific to the application exchanging
  SOAP messages.
• Recall the phone number request in the example.
• One SOAP-defined body entry exists, is the Fault
  element.
   – Optional child that must not appear more than once within
     the body element.
   – Comprises error and status information.
SOAP Message Fault Body Entry
       Subordinates

• faultcode: fault identification
   – VersionMismatch: namespace qualification is not identical to:
     http://schemas.xmlsoap.org/soap/envelope/
   – MustUnderstand: SOAP application could not process a header
     entry containing “MustUnderstand” with value „1‟.
   – Client: a SOAP message is not appropriately formed.
   – Server: a SOAP message could not be processed
• faultstring: human readable fault explanation
• faultactor: carries a URI value that identifies the fault
  originator.
• detail: application-specific error info related the body element.
A failing intermediary

• Recall the example of requesting the phone number of Ahmad M.
  Ahmad.
• Enforced by means of mustUnderstand, suppose the intermediary
  does not understand the header, it responds with fault element:

<soap-env:Envelope
   xmlns:soap-
   env="http://schemas.xmlsoap.org/soap/envelope/">
    <soap-env:Body>
     <soap-env:Fault>
      <faultcode>soap-env: MustUnderstand</faultcode>
      <faultstring>
       SOAP MustUnderstand Error </faultstring>
      <faultactor>
        http://companyx.com/messageHub_71</faultactor>
    </soap-env:Fault>
   </soap-env:Body>
</soap-env:Envelope>
Visit to see the envelope schema!

http://schemas.xmlsoap.org/soap/envelope/
Session Outlines

  Introduction
      History, definition and basic role
      characteristics
    SOAP Message format
    SOAP section 5 encoding
    SOAP communication styles
    Summary
SOAP section 5 Encoding

• Connecting heterogeneous applications typically introduces the
  data-type compatibility problem
• Solution is often based on a common intermediate transfer data
  format for exchanging information between applications
• SOAP section 5 encoding rules provide a built in mechanism to
  do that, with appropriate programming languages mappings.
• Using SOAP section 5 encoding is optional, and other
  encodings may be used as well.
SOAP Values and Data Types

• The SOAP encoding data model consists of simple types and
  compound types.
• Compound types are based on simple types or other compound
  types.
• Any application-specific data is represented in terms of a
  directed graph.
SOAP Values and Data Types, cont.

• Simple value: e.g. string, integer or Boolean, is represented as a
  node without outgoing edges.
• Compound value: e.g. structure or array, is represented with
  outgoing edges.
• A simple or compound values may be single-referenced “has
  only one incoming edge” or multi-referenced “has multiple
  incoming edge”.
• The SOAP data model is shown in the next slide!
The SOAP Data Model

Represented as an XML element
                                                         address




                                                                      Postal code
                                      Name
                                                                                     100
                                                                   City
                                             Street

                                                                          Ramallah
                                                 Alquds
              First Name       Last Name         Street


             Ahmad                  Ahmad

                                                      Represented as an XML element that is subordinate
                                                              of the one represents the address



                           The SOAP data model, Source, [6] with modification.
SOAP Data Types I

• SOAP encoding adopts all XML schema built-in types.
• But, compound types differ fundamentally from XML schema
  complex types.
• SOAP types extending the XML schema types are defined in
  the separate namespace:

http://schemas.xmlsoap.org/soap/encoding/
SOAP Data Types II

• Sender could explicitly assert the type street element content to
  be a string:
  <street xsi:type=“xsd:string”>Alquds Street</street>
• Or, may not contain the type attribute:
  <street>Alquds Street</street>
• SOAP simple values: represented as element content.
   – For each element containing a value, the type is made via XML schema
     instance type attribute.
   – e.g. <last-name xsi:type=“xsd:string”>Ahmad</last-name>
SOAP Data Types III

• SOAP compound values: represented as an element containing a
  sequence of subordinate elements.
   – SOAP encoding supports two compound types: structs and arrays
   – e.g. XML encoding for an array in the SOAP object model looks like this:
       <nameArray xsi:type=“SOAP-ENC:array” SOAP-
       ENC:arrayType=“xsd:string[3]”>
           <member>First Name</member>
           <member>Med. Name</member>
           <member>Last Name</member>
       </nameArray>
Session Outlines

  Introduction
      History, definition and basic role
      characteristics
    SOAP Message format
    SOAP section 5 encoding
    SOAP communication styles
    Summary
SOAP Communication style


• SOAP supports two communication styles:
  – Document style: SOAP message body is an arbitrary XML
    instance.
     • The document style is referred to as message-oriented style.
  – RPC style: represents a remote procedure call.
     • A client invoking a remote procedure expects a result back from the
       server.
     • Recall our example, it was an RPC style SOAP message
     • The client invoked the method getPhoneNumber.
A document style SOAP message




           Source, [6]
A document style SOAP message example
<SOAP-ENV:Envelope
 xmlns:SOAP-ENV=“http://schemas.xmlsoap.org/soap/envelope/”>
  <SOAP-ENV:Body>
    <ph:phoneOwner xmlns:ph=“http://companyx.com/ns/phoneBook”>
      <cX:address xmlns:cX=“http://companyx.com/ns/employees”
       targetAddress="PS">
        <cX:name>
          <cX:title selectedTitle=“Mr”/>
          <cX:first-name>Ahmad M.<cX:first-name>
          <cX:last-name>Ahmad</cX:last-name>
        </cX:name>
        <cX:street>Alquds Street</cX:street>
        <cX:city>Ramallah<cX:city>
        <cX:postal-code>100</cX:postal-code>
        <cX:country>Palestine</cX:country>
      </cX:address>
      <ph:phonebook>
        <ph:location>Ramallah Office</ph:location>
        <ph:roomNumber>03.04</ph:roomNumber>
        <ph:officePhone>*2900000</ph:officePhone>
      </ph:phone>
    </ph:phoneOwner>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
A SOAP RPC style request and the associated
response




              Source, [6]
Response on the phone number request from
     the earlier example (slide 18)
<SOAP-ENV:Envelope
 xmlns:SOAP-
ENV=“http://schemas.xmlsoap.org/soap/envelope/”
 xmlns:xsd=“http://www.w3.org/2001/schema”
 xmlns:xsi=“http://www.w3.org/2001/schema-instance”>
  <SOAP-ENV:Body>
    <companyx:getPhoneNumberReturn
     xmlns:companyx=“http://companyx/employees”
     SOAP=ENV:encodingStyle=
     “http://schemas.xmlsoap.org/soap/encoding/”>
      <return xsi:type=“xsd:string”>
        *2900000</return>
    </companyx:getPhoneNumberReturn>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Practices

• Using WCF test client in Visual Studio to test AgeInDays
  service and view the SOAP messages.
Session Outlines

  Introduction
      History, definition and basic role
      characteristics
    SOAP Message format
    SOAP section 5 encoding
    SOAP communication styles
    Summary
Summary

During this session we have explained the SOAP message
   construction for web services communication. The following
   subjects have been covered:
         1. SOAP definition and characteristics
         2. SOAP Message format
         3. SOAP section 5 encoding
         4. SOAP communication styles
In the following session we will introduce how to describe a web
     service using WSDL.
Further reading on SOAP 1.1 can be found at the following link:
     http://www.w3.org/TR/2000/NOTE-SOAP-20000508/
References

1. Steve Graham, Doug Davis, Simeon Simeonov,Glen Daniels, Peter Brittenham, Yuichi
   Nakamura, Paul Fremantle,Dieter König and Claudia Zentner, Building Web Services
   with Java, M A K I N G S E N S E O F X M L , S O A P , W S D L , A N D U D D I,
   Second Edition, Sams Publishing, 800 East 96th Street, Indianapolis, Indiana 46240,
   2005.
2. Extracted from: http://en.wikipedia.org/wiki/SOAP
3. Extracted from http://www.w3.org/TR/soap12-part1
4. Aaron Skonnard, Understanding SOAP, Microsoft Digital Network,
   “http://msdn.microsoft.com/en-us/library/ms995800.aspx”,March 2003
5. Andrew Lader, Lonnie Wall, Building Web Services and .NET Applications, McGraw-Hill,
   2002.
6. Olaf Zimmermann, Mark Tomlinson, Stefan Peuser, “Perspectives on Web services-
   Applying SOAP, WSDL and UDDI to real-world projects, 2nd edition, Springer, 2005
7. Extracted from: http://www.w3.org/TR/2000/NOTE-SOAP-20000508/
Thanks
Mohammed Aldasht

More Related Content

PDF
Pal gov.tutorial3.session4.rest
PDF
Pal gov.tutorial3.session0.outline
PPT
SOAP, WSDL and UDDI
PDF
Data, Information And Knowledge Management Framework And The Data Management ...
PDF
Pal gov.tutorial3.session7
PDF
Pal gov.tutorial3.session1.soa
PDF
Pal gov.tutorial3.session11.integration.patterns
PDF
Pal gov.tutorial3.session13.bpel
Pal gov.tutorial3.session4.rest
Pal gov.tutorial3.session0.outline
SOAP, WSDL and UDDI
Data, Information And Knowledge Management Framework And The Data Management ...
Pal gov.tutorial3.session7
Pal gov.tutorial3.session1.soa
Pal gov.tutorial3.session11.integration.patterns
Pal gov.tutorial3.session13.bpel

Similar to Pal gov.tutorial3.session6.soap (20)

PDF
Pal gov.tutorial3.session9.esb
PDF
Pal gov.tutorial3.session5.lab2
PDF
Pal gov.tutorial3.session14.lab6
PDF
Pal gov.tutorial3.session3.xpath & xquery (lab1)
PDF
Pal gov.tutorial3.session12.lab5
PDF
Pal gov.tutorial3.session2.xml ns and schema
PDF
Pal gov.tutorial3.session8.lab3
PDF
Pal gov.tutorial3.session10.lab4
PDF
Pal gov.tutorial3.session15.uddi
DOCX
Web services Concepts
PDF
Pal gov.tutorial2.session3.xml schemas
PDF
Pal gov.tutorial2.session12 2.architectural solutions for the integration issues
PDF
Pal gov.tutorial2.session2.xml dtd's
PDF
PDF
Xml Messaging With Soap
PDF
Xml messaging with soap
PDF
Xm Lmessagingwith Soap
PDF
Pal gov.tutorial2.session12 1.the problem of data integration
PDF
Pal gov.tutorial2.session1.xml basics and namespaces
PDF
Pal gov.tutorial2.session15 1.linkeddata
Pal gov.tutorial3.session9.esb
Pal gov.tutorial3.session5.lab2
Pal gov.tutorial3.session14.lab6
Pal gov.tutorial3.session3.xpath & xquery (lab1)
Pal gov.tutorial3.session12.lab5
Pal gov.tutorial3.session2.xml ns and schema
Pal gov.tutorial3.session8.lab3
Pal gov.tutorial3.session10.lab4
Pal gov.tutorial3.session15.uddi
Web services Concepts
Pal gov.tutorial2.session3.xml schemas
Pal gov.tutorial2.session12 2.architectural solutions for the integration issues
Pal gov.tutorial2.session2.xml dtd's
Xml Messaging With Soap
Xml messaging with soap
Xm Lmessagingwith Soap
Pal gov.tutorial2.session12 1.the problem of data integration
Pal gov.tutorial2.session1.xml basics and namespaces
Pal gov.tutorial2.session15 1.linkeddata
Ad

More from Mustafa Jarrar (20)

PPTX
Clustering Arabic Tweets for Sentiment Analysis
PPTX
Classifying Processes and Basic Formal Ontology
PPTX
Discrete Mathematics Course Outline
PPTX
Business Process Implementation
PPTX
Business Process Design and Re-engineering
PPTX
BPMN 2.0 Analytical Constructs
PPTX
BPMN 2.0 Descriptive Constructs
PPTX
Introduction to Business Process Management
PDF
Customer Complaint Ontology
PPTX
Subset, Equality, and Exclusion Rules
PPTX
Schema Modularization in ORM
PPTX
On Computer Science Trends and Priorities in Palestine
PPTX
Lessons from Class Recording & Publishing of Eight Online Courses
PPTX
Presentation curras paper-emnlp2014-final
PPTX
Jarrar: Future Internet in Horizon 2020 Calls
PPT
Habash: Arabic Natural Language Processing
PDF
Adnan: Introduction to Natural Language Processing
PPTX
Riestra: How to Design and engineer Competitive Horizon 2020 Proposals
PPTX
Bouquet: SIERA Workshop on The Pillars of Horizon2020
PPTX
Jarrar: Sparql Project
Clustering Arabic Tweets for Sentiment Analysis
Classifying Processes and Basic Formal Ontology
Discrete Mathematics Course Outline
Business Process Implementation
Business Process Design and Re-engineering
BPMN 2.0 Analytical Constructs
BPMN 2.0 Descriptive Constructs
Introduction to Business Process Management
Customer Complaint Ontology
Subset, Equality, and Exclusion Rules
Schema Modularization in ORM
On Computer Science Trends and Priorities in Palestine
Lessons from Class Recording & Publishing of Eight Online Courses
Presentation curras paper-emnlp2014-final
Jarrar: Future Internet in Horizon 2020 Calls
Habash: Arabic Natural Language Processing
Adnan: Introduction to Natural Language Processing
Riestra: How to Design and engineer Competitive Horizon 2020 Proposals
Bouquet: SIERA Workshop on The Pillars of Horizon2020
Jarrar: Sparql Project
Ad

Recently uploaded (20)

PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
KodekX | Application Modernization Development
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
Big Data Technologies - Introduction.pptx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Spectroscopy.pptx food analysis technology
PPT
Teaching material agriculture food technology
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
NewMind AI Weekly Chronicles - August'25 Week I
KodekX | Application Modernization Development
Review of recent advances in non-invasive hemoglobin estimation
Encapsulation_ Review paper, used for researhc scholars
Advanced methodologies resolving dimensionality complications for autism neur...
Reach Out and Touch Someone: Haptics and Empathic Computing
Big Data Technologies - Introduction.pptx
Diabetes mellitus diagnosis method based random forest with bat algorithm
The AUB Centre for AI in Media Proposal.docx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
20250228 LYD VKU AI Blended-Learning.pptx
Spectroscopy.pptx food analysis technology
Teaching material agriculture food technology
Programs and apps: productivity, graphics, security and other tools
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows

Pal gov.tutorial3.session6.soap

  • 1. ‫أكاديمية الحكومة اإللكترونية الفلسطينية‬ The Palestinian eGovernment Academy www.egovacademy.ps Tutorial III: Process Integration and Service Oriented Architectures Session 7 SOAP Prepared By Mohammed Aldasht Reviewed by Prof. Marco Ronchetti and Prof. Paolo Bouquet, Trento University, Italy PalGov © 2011 1
  • 2. About This tutorial is part of the PalGov project, funded by the TEMPUS IV program of the Commission of the European Communities, grant agreement 511159-TEMPUS-1- 2010-1-PS-TEMPUS-JPHES. The project website: www.egovacademy.ps Project Consortium: Birzeit University, Palestine University of Trento, Italy (Coordinator ) Palestine Polytechnic University, Palestine Vrije Universiteit Brussel, Belgium Palestine Technical University, Palestine Université de Savoie, France Ministry of Telecom and IT, Palestine University of Namur, Belgium Ministry of Interior, Palestine TrueTrust, UK Ministry of Local Government, Palestine Coordinator: Dr. Mustafa Jarrar Birzeit University, P.O.Box 14- Birzeit, Palestine Telfax:+972 2 2982935 mjarrar@birzeit.eduPalGov © 2011 2
  • 3. © Copyright Notes Everyone is encouraged to use this material, or part of it, but should properly cite the project (logo and website), and the author of that part. No part of this tutorial may be reproduced or modified in any form or by any means, without prior written permission from the project, who have the full copyrights on the material. Attribution-NonCommercial-ShareAlike CC-BY-NC-SA This license lets others remix, tweak, and build upon your work non- commercially, as long as they credit you and license their new creations under the identical terms. PalGov © 2011 3
  • 4. Tutorial Map Intended Learning Objectives A: Knowledge and Understanding Title T Name 3a1: Demonstrate knowledge of the fundamentals of middleware. 3a2: Describe the concept behind web service protocols. Session0: Syllabus and overview 0 Aldasht 3a3: Explain the concept of service oriented architecture. Sesson1: Introduction to SOA 2 Aldasht 3a4: Explain the concept of enterprise service bus. Session2: XML namespaces & XML schema 2 Aldasht 3a5: Understanding WSDL service interfaces in UDDI. Session 3: Xpath & Xquery 4 Romi B: Intellectual Skills Session4: REST web services 3 M. Melhem 3b1: Design, develop, and deploy applications based on Service Session5: Lab2: Practice on REST 3 M. Melhem Oriented Architecture (SOA). Session 6: SOAP 2 Aldasht 3b2: use Business Process Execution Language (BPEL). Session 7: WSDL 3 Aldasht 3b3: using WSDL to describe web services. Session8: Lab 3: WSDL practice 3 Aldasht C: Professional and Practical Skills Session9: ESB 4 Aldasht 3c1: setup, Invoke, and deploy web services using integrated Session10: Lab4: Practice on ESB 4 Aldasht development environment. Session11: integration patterns 4 M. Melhem 3c2: construct and use REST and SOAP messages for web services communication. Session12: Lab5: integration patterns 4 M. Melhem D: General and Transferable Skills Session13: BPEL 3 Aldasht d1: Working with team. Session14: Lab6: Practice on BPEL 3 Aldasht d2: Presenting and defending ideas. Session15: UDDI 2 Aldasht d3: Use of creativity and innovation in problem solving. d4: Develop communication skills and logical reasoning abilities.
  • 5. Session 7: SOAP protocol Session ILOs After completing this module students will be able to discuss the: 1. Construction of SOAP messages for web services communication 2. Use SOAP messages for web services communication
  • 6. Session Outlines  Introduction  History, definition and basic role  characteristics  SOAP Message format  SOAP section 5 encoding  SOAP communication styles  Summary
  • 7. Introduction: History • Microsoft started thinking about XML-based distributed computing in 1997 to enable applications to communicate via RPCs [1]. • In 2000, the XML Protocol working group at the W3C was formed to design the XML protocol “core of XML-based distributed computing”. • The group started with SOAP 1.1 as a first working draft, then SOAP 1.2 in 2003
  • 8. SOAP is based on XML concepts Web Services Application Code SOAP API SOAP XML / XML namespace / XML Schema Source, [6]
  • 9. Introduction: Definition • Simple Object Access Protocol (SOAP): – An XML-based protocol specification for exchanging structured information in the implementation of Web Services [2]. • SOAP relies on other Application Layer protocols, most notably RPC and HTTP for message negotiation and transmission. • SOAP can form the foundation layer of a web services protocol stack • It provides a basic messaging framework upon which web services can be built.
  • 10. SOAP basic Role • The role of SOAP [1]: – A Web service is a software system designed to support interoperable machine-to-machine interaction. – A Web service has an interface described in a machine processable format (specifically WSDL). – Other systems interact with the Web service in a manner prescribed by its description using SOAP-messages, typically conveyed using HTTP with an XML serialization in conjunction with other Web related standards.
  • 11. SOAP Characteristics • Provides a mechanism for defining the unit of communication using identifiable SOAP message. • Provides a processing model: – A set of rules for dealing with SOAP messages in software which is the key to use the protocol successfully. • Provides an extensibility model: using any number of SOAP headers to implement arbitrary extensions on top of SOAP.
  • 12. SOAP Characteristics, cont. • Provides a mechanism for error handling • Provides a flexible mechanism for data representation (text, XML, …) • Provides a convention for representing Remote Procedure Calls (RPCs) and responses as SOAP messages • Provides a protocol binding framework: an architecture for building bindings to send and receive SOAP messages over arbitrary underlying transports, HTTP, TCP, UDP, ….
  • 13. Session Outlines  Introduction  History, definition and basic role  characteristics  SOAP Message format  SOAP section 5 encoding  SOAP communication styles  Summary
  • 14. SOAP Message format • SOAP messages are XML instances consisting of [6]: – Envelope: a mandatory top element represents the SOAP message and provide a container for header and body. – Header: an optional element offers a way to pass additional processing or control info. • Could convey authentication, QoS and service billing data, and extra header entries. • If present, it must be the first immediate child. – Body: a mandatory element carries all mandatory info “body entries” for the final recipient
  • 15. SOAP Message format SOAP message Envelope Mandatory Containment Structure. Source, [6] 0..1 1 Optional Containment relationship Header Body n n “Header “Body “Header “Body entry” Entry” entry” Entry”
  • 16. SOAP message Embedded in HTTP Request for GetMyAgeInDays Service POST /WebSite2/Service.asmx HTTP/1.1 Host: localhost Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "http://tempuri.org/GetMyAgeInDays" <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <GetMyAgeInDays xmlns="http://tempuri.org/"> <day>int</day> <month>int</month> <year>int</year> </GetMyAgeInDays> </soap:Body> </soap:Envelope>
  • 17. SOAP Message Embedded in HTTP Response for GetMyAgeInDays Service HTTP/1.1 200 OK Content-Type: text/xml; charset=utf-8 Content-Length: length <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <GetMyAgeInDaysResponse xmlns="http://tempuri.org/"> <GetMyAgeInDaysResult>int</GetMyAgeInDaysResult> </GetMyAgeInDaysResponse> </soap:Body> </soap:Envelope>
  • 18. SOAP message Example <soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/Schema" xmlns:xsi="http://www.w3.org/2001/Schema-instance"> <soap-env:Header> <!-- optional --> Header Entry <cXP:priority xmlns:cXP=“http://companyx.com/ns/priority” soap-env:mustUnderstand=“1”> Header Must be processed high </cXP:priority> Method </soap-env:Header> Use SOAP invocation <soap-env:Body> encoding Body Entry <cX:getPhoneNumebr xmlns:cX=“http://companyx.com/ns/employees” soap-env:encodingStyle=“http://schemas.xmlsoap.org/soap/encoding/”> Method <first-name xsi:type=“xsd:string”>Ahmad</first-name> Parameters <last-name xsi:type=“xsd:string”>Ahmad</last-name> </cX:getPhoneNumber> </soap-env:Body> Method Parameter Method Parameter </soap-env:Envelope> type value Source, [6]
  • 19. SOAP Message Delivery • SOAP messages may be handed over from a WS requester to a service provider via intermediaries. • Similar to service providers, intermediaries are identified also via URI value. • For example, when embedding SOAP into HTTP, the URI maps to the HTTP request URL.
  • 20. SOAP Message Attributes • encodingStyle: indicates the serialization rules used in the message. – Serialization is converting from an application-specific data representation to the wire format. – While, deserialization is converting back to the original format. – Also, called marshalling and unmarshalling. – Identified through URI in a body entry and applied until another encodingStyle attribute appears in the body element e.g. http://schemas.xmlsoap.org/soap/encoding/
  • 21. SOAP Message Attributes, cont. • actor: identifies the application that should process the header entry. e.g. http://schemas.xmlsoap.org/soap/actor/next • mustUnderstand: identifies whether a SOAP message receiver “target actor” must understand ,value „1‟, the content of a header entry.
  • 22. SOAP Message Body Entries • Recipient must understand and process all body entries. • Body entries are specific to the application exchanging SOAP messages. • Recall the phone number request in the example. • One SOAP-defined body entry exists, is the Fault element. – Optional child that must not appear more than once within the body element. – Comprises error and status information.
  • 23. SOAP Message Fault Body Entry Subordinates • faultcode: fault identification – VersionMismatch: namespace qualification is not identical to: http://schemas.xmlsoap.org/soap/envelope/ – MustUnderstand: SOAP application could not process a header entry containing “MustUnderstand” with value „1‟. – Client: a SOAP message is not appropriately formed. – Server: a SOAP message could not be processed • faultstring: human readable fault explanation • faultactor: carries a URI value that identifies the fault originator. • detail: application-specific error info related the body element.
  • 24. A failing intermediary • Recall the example of requesting the phone number of Ahmad M. Ahmad. • Enforced by means of mustUnderstand, suppose the intermediary does not understand the header, it responds with fault element: <soap-env:Envelope xmlns:soap- env="http://schemas.xmlsoap.org/soap/envelope/"> <soap-env:Body> <soap-env:Fault> <faultcode>soap-env: MustUnderstand</faultcode> <faultstring> SOAP MustUnderstand Error </faultstring> <faultactor> http://companyx.com/messageHub_71</faultactor> </soap-env:Fault> </soap-env:Body> </soap-env:Envelope>
  • 25. Visit to see the envelope schema! http://schemas.xmlsoap.org/soap/envelope/
  • 26. Session Outlines  Introduction  History, definition and basic role  characteristics  SOAP Message format  SOAP section 5 encoding  SOAP communication styles  Summary
  • 27. SOAP section 5 Encoding • Connecting heterogeneous applications typically introduces the data-type compatibility problem • Solution is often based on a common intermediate transfer data format for exchanging information between applications • SOAP section 5 encoding rules provide a built in mechanism to do that, with appropriate programming languages mappings. • Using SOAP section 5 encoding is optional, and other encodings may be used as well.
  • 28. SOAP Values and Data Types • The SOAP encoding data model consists of simple types and compound types. • Compound types are based on simple types or other compound types. • Any application-specific data is represented in terms of a directed graph.
  • 29. SOAP Values and Data Types, cont. • Simple value: e.g. string, integer or Boolean, is represented as a node without outgoing edges. • Compound value: e.g. structure or array, is represented with outgoing edges. • A simple or compound values may be single-referenced “has only one incoming edge” or multi-referenced “has multiple incoming edge”. • The SOAP data model is shown in the next slide!
  • 30. The SOAP Data Model Represented as an XML element address Postal code Name 100 City Street Ramallah Alquds First Name Last Name Street Ahmad Ahmad Represented as an XML element that is subordinate of the one represents the address The SOAP data model, Source, [6] with modification.
  • 31. SOAP Data Types I • SOAP encoding adopts all XML schema built-in types. • But, compound types differ fundamentally from XML schema complex types. • SOAP types extending the XML schema types are defined in the separate namespace: http://schemas.xmlsoap.org/soap/encoding/
  • 32. SOAP Data Types II • Sender could explicitly assert the type street element content to be a string: <street xsi:type=“xsd:string”>Alquds Street</street> • Or, may not contain the type attribute: <street>Alquds Street</street> • SOAP simple values: represented as element content. – For each element containing a value, the type is made via XML schema instance type attribute. – e.g. <last-name xsi:type=“xsd:string”>Ahmad</last-name>
  • 33. SOAP Data Types III • SOAP compound values: represented as an element containing a sequence of subordinate elements. – SOAP encoding supports two compound types: structs and arrays – e.g. XML encoding for an array in the SOAP object model looks like this: <nameArray xsi:type=“SOAP-ENC:array” SOAP- ENC:arrayType=“xsd:string[3]”> <member>First Name</member> <member>Med. Name</member> <member>Last Name</member> </nameArray>
  • 34. Session Outlines  Introduction  History, definition and basic role  characteristics  SOAP Message format  SOAP section 5 encoding  SOAP communication styles  Summary
  • 35. SOAP Communication style • SOAP supports two communication styles: – Document style: SOAP message body is an arbitrary XML instance. • The document style is referred to as message-oriented style. – RPC style: represents a remote procedure call. • A client invoking a remote procedure expects a result back from the server. • Recall our example, it was an RPC style SOAP message • The client invoked the method getPhoneNumber.
  • 36. A document style SOAP message Source, [6]
  • 37. A document style SOAP message example <SOAP-ENV:Envelope xmlns:SOAP-ENV=“http://schemas.xmlsoap.org/soap/envelope/”> <SOAP-ENV:Body> <ph:phoneOwner xmlns:ph=“http://companyx.com/ns/phoneBook”> <cX:address xmlns:cX=“http://companyx.com/ns/employees” targetAddress="PS"> <cX:name> <cX:title selectedTitle=“Mr”/> <cX:first-name>Ahmad M.<cX:first-name> <cX:last-name>Ahmad</cX:last-name> </cX:name> <cX:street>Alquds Street</cX:street> <cX:city>Ramallah<cX:city> <cX:postal-code>100</cX:postal-code> <cX:country>Palestine</cX:country> </cX:address> <ph:phonebook> <ph:location>Ramallah Office</ph:location> <ph:roomNumber>03.04</ph:roomNumber> <ph:officePhone>*2900000</ph:officePhone> </ph:phone> </ph:phoneOwner> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
  • 38. A SOAP RPC style request and the associated response Source, [6]
  • 39. Response on the phone number request from the earlier example (slide 18) <SOAP-ENV:Envelope xmlns:SOAP- ENV=“http://schemas.xmlsoap.org/soap/envelope/” xmlns:xsd=“http://www.w3.org/2001/schema” xmlns:xsi=“http://www.w3.org/2001/schema-instance”> <SOAP-ENV:Body> <companyx:getPhoneNumberReturn xmlns:companyx=“http://companyx/employees” SOAP=ENV:encodingStyle= “http://schemas.xmlsoap.org/soap/encoding/”> <return xsi:type=“xsd:string”> *2900000</return> </companyx:getPhoneNumberReturn> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
  • 40. Practices • Using WCF test client in Visual Studio to test AgeInDays service and view the SOAP messages.
  • 41. Session Outlines  Introduction  History, definition and basic role  characteristics  SOAP Message format  SOAP section 5 encoding  SOAP communication styles  Summary
  • 42. Summary During this session we have explained the SOAP message construction for web services communication. The following subjects have been covered: 1. SOAP definition and characteristics 2. SOAP Message format 3. SOAP section 5 encoding 4. SOAP communication styles In the following session we will introduce how to describe a web service using WSDL. Further reading on SOAP 1.1 can be found at the following link: http://www.w3.org/TR/2000/NOTE-SOAP-20000508/
  • 43. References 1. Steve Graham, Doug Davis, Simeon Simeonov,Glen Daniels, Peter Brittenham, Yuichi Nakamura, Paul Fremantle,Dieter König and Claudia Zentner, Building Web Services with Java, M A K I N G S E N S E O F X M L , S O A P , W S D L , A N D U D D I, Second Edition, Sams Publishing, 800 East 96th Street, Indianapolis, Indiana 46240, 2005. 2. Extracted from: http://en.wikipedia.org/wiki/SOAP 3. Extracted from http://www.w3.org/TR/soap12-part1 4. Aaron Skonnard, Understanding SOAP, Microsoft Digital Network, “http://msdn.microsoft.com/en-us/library/ms995800.aspx”,March 2003 5. Andrew Lader, Lonnie Wall, Building Web Services and .NET Applications, McGraw-Hill, 2002. 6. Olaf Zimmermann, Mark Tomlinson, Stefan Peuser, “Perspectives on Web services- Applying SOAP, WSDL and UDDI to real-world projects, 2nd edition, Springer, 2005 7. Extracted from: http://www.w3.org/TR/2000/NOTE-SOAP-20000508/