SOAP

From Training Material
Jump to navigation Jump to search
title
Web Services Basics For Non-programmers
author
Pete George (NobleProg Ltd)

Day One Schedule ⌘

  1. Introductions
  2. Service-Oriented Architecture
  3. Web Services Overview
  4. XML
  5. SOAP

SOAP ⌘

Learning Objectives

  • To understand the place of SOAP in Web services
  • To appreciate the advantages of using SOAP
  • To understand the basic SOAP structure
  • To explore SOAP requests and responses on a Web service

SOAP Protocol Messaging

SOAP 1.png

SOAP Metaphor ⌘

  • XML = Language of message

-English

  • SOAP = Style of message

-Business letter

SOAP 2.png

SOAP Definition ⌘

“a lightweight protocol for exchange of information in a decentralized, distributed environment” (W3C)

SOAP ⌘

  • Originally: “Simple Object Access Protocol”
  • Just “SOAP” since 1.2
  • Protocol used for exchanging data
  • Uses XML to describe information
  • Usually uses HTTP(S) for transportation

Advantages of SOAP ⌘

  • XML
  • HTTP
  • Additional Benefits

XML Benefits ⌘

  • Interoperability

-Platform-neutral

-Language-neutral

-Vendor-neutral

  • Easy to implement

-Minimum Web server + ASP page/CGI script

HTTP Benefits ⌘

  • HTTP well known and used network protocol
  • Firewall-safe
  • Can use HTTP over SSL (HTTPS)
  • NB: SOAP can use other transport protocols

Additional Benefits ⌘

  • Robust

-Can create own XML structure

  • Use other XML technologies

-E.g. XML-Signature for security

  • Can use attachments
  • Flexible

-Can represent complex messages

Can cope with messages being passed along a chain

SOAP Structure ⌘

  • Envelope

-Container for message

  • Header

-Information about the message

  • Body

-The message

A SOAP Service Request ⌘

SOAP 4.png

<Envelope> ⌘

<mySoap:Envelope 
xmlns:mySoap="http://schemas.xmlsoap.o
 rg/soap/envelope/" 
 xmlns:wsx="http://www.webserviceX.NET">
  • Root element for XML doc
  • Lists namespace declarations, e.g:

-mySoap = SOAP XML namespace

-wsx = namespace for service provider

<Header> ⌘

<mySoap:Header/>
(<mySoap:Header></mySoap:Header>)
  • Optional
  • Often omitted
  • Could contain instructions for handling message

-e.g. user credentials

<Body> ⌘

SOAP 5.png

A SOAP Service Response ⌘

SOAP 6.png

A SOAP Service Response - Fault ⌘

SOAP 3.png

<Fault> ⌘

SOAP 7.png

Summary Exercise ⌘

Using the JMeter test tool, send a request to the Periodic Table Web service

  • Use Get Atomic Number to get the atomic number of Hydrogen
  • Analyse the Service Response and identify SOAP structural elements: namespaces, root element, header, body, fault
  • Investigate other methods/Web services available