WSDL

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

Day One Revision ⌘

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

SOA & Web Services ⌘

Service-Oriented Architecture

Without Agreed standards

Atomic

Interoperability

Service Request

Loose coupling

Brittleness

Hide information (service abstraction)

10. Are reusable services: a. used many times b. used in multiple processes

b. Used in multiple processes

Name the features ⌘

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <mySoap:Envelope
  3. xmlns:mySoap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsx="http://www.webserviceX.NET">
  4. <mySoap:Header/>
  5. <mySoap:Body>
  6. <wsx:GetAtomicNumber>
  7. <wsx:ElementName>Oxygen</wsx:ElementName>
  8. </wsx:GetAtomicNumber>
  9. </mySoap:Body>
  10. </mySoap:Envelope>

Name the features (answers) ⌘

  1. Prolog
  2. Root Element
  3. SOAP Envelope
  4. Namespace Declaration
  5. Attribute
  6. SOAP Header
  7. SOAP Body
  8. Body Block
  9. Element
  10. Namespace

Day Two Schedule ⌘

  1. WSDL
  2. Handling Binary Content
  3. RESTfull Web Services
  4. Other Technologies
  5. Conclusion

WSDL ⌘

WSDL 1.png

WSDL Metaphor ⌘

  • XML = Language of message

-English

  • SOAP = Style of message

-Business letter

  • WSDL = specific instructions on what to write + what the response will be

11/18/2013 Pete George NobleProg Dear Sir

NobleProg Chiswick 123456789 123456789 someone@nobleprog.com

Interface Definition Language ⌘

  • Defines language for ORB interfaces (e.g. CORBA)
  • Objects have defined contract with outside world

-Methods

-Method parameters

-Return values

  • Usually interface investigated during programming

Web Services Description Language ⌘

  • Standardized way to describe a Web service
  • Not language-specific

-Describes data to be passed

-Describes method for passing data

  • The basis of the original Web services specification
  • WSDL 2.0 Became W3C recommendation 2007
  • Originally used in conjunction with UDDI

UDDI Registry ⌘

  • Universal Description, Discovery, and Integration
  • Intended to provide way to discover Web services

-contact information for organisations

-services available from organisations

  • Not been widely implemented

WSDL with UDDI ⌘

WSDL 2.png

1. Services Described Using WSDL ⌘

WSDL 3.png

  • Service Provider describes its service using WSDL
  • Definition published to registry of services
  • Registry uses UDDI

2. Registry Services Queried ⌘

WSDL 4.png

  • Service Consumer issues one or more queries to registry:

-to locate a service

-to determine how to communicate with service

3. WSDL Service Details Supplied ⌘

WSDL 5.png

  • Registry provides response to Consumer queries
  • i.e WSDL section containing details of the Provider’s requests and responses

4. Service Request Sent ⌘

WSDL 6.png

  • Service Consumer has WSDL request details passed from UDDI registry
  • Service Consumer sends XML request

5. Service Response Returned ⌘

WSDL 7.png

  • Service Provider sends XML request
  • Service Consumer knows from WSDL details (passed from UDDI Registry) what response message should look like

WSDL without UDDI ⌘

WSDL 8.png

1. Service Request Sent ⌘

WSDL 6.png

  • Service Consumer knows WSDL request details
  • Service Consumer sends XML request

2. Service Response Returned ⌘

WSDL 7.png

  • Service Provider sends XML request
  • Service Consumer knows from WSDL details what response message should look like

Obtaining WSDL ⌘

  • Usually by simple request, e.g.

GET

http://www.webservicex.net/periodictable.asmx?wsdl

WSDL 9.png

<definitions> ⌘

  • Root Element
  • Includes Namespace declarations
  • Includes WSDL and SOAP declarations

Periodic Table <definitions> ⌘

WSDL 10.png

<types> ⌘

  • WSDL file builds up in levels – starts with data types
  • Defined in terms of XML Schema

Periodic Table <types> ⌘

<wsdl:definitions xmlns:s="http://www.w3.org/2001/XMLSchema">
 <wsdl:types>
   <s:schema
     <s:element name="GetAtomicNumber">
       <s:complexType>
         <s:sequence>
           <s:element minOccurs="0" maxOccurs="1" name="ElementName" type="s:string" />
         </s:sequence>
       </s:complexType>
     </s:element>

<messages> ⌘

  • Defines content

-What the message is

-What kind of data it holds

Periodic Table <messages> ⌘

WSDL 12.png

Periodic Table SOAP message ⌘

  • Can be translated into SOAP message, e.g.

WSDL 13.png

<portType> ⌘

  • Define individual operations provided by service

-Input and Output operations

-Consist of messages

<portType> ⌘

WSDL 14.png

<binding> ⌘

  • Binds operations to protocol, includes:

-<soap:binding>

  • specifies binding to SOAP
  • Transport type, e.g. HTTP

-<soap:operation>

  • Specifies SOAPAction header – redundant

-<soap:body>

  • Define how messages are presented
  • Literal or encoded

<binding> ⌘

WSDL 15.png

<service> ⌘

  • <port> How to send the information

-Binding information, e.g. <wsdl:port name="periodictableSoap" binding="tns:periodictableSoap">

  • <soap:address> Where to send the information

-Location of the Web service, e.g.

<soap:address location="http://www.webservicex.net/periodictable.asmx" />

<service> ⌘

<wsdl:service name="periodictable">
   <wsdl:port name="periodictableSoap" 			binding="tns:periodictableSoap">
     <soap:address location="http://www.webservicex.net/periodictable.asmx" />
   </wsdl:port>

Summary Exercise 1 ⌘

Using the JMeter test tool, create a SOAP Service Request to retrieve the weight of an atom from the Periodic Table Web service.

See:

http://www.webservicex.net/periodictable.asmx?wsdl

(you might like to open the WSDL in a separate JMeter instance while you work)

  1. Start from PortType = "periodictableSoap"
  2. Create Message
  3. Use appropriate Types

Summary Exercise 2 ⌘

Confirm Exercise 1 SOAP message is correct:

  1. Pull Periodic Table WSDL into SoapUI
  2. Execute Ex1 SOAP message in JMeter. Compare Response Message with expected Response message in WSDL.
  3. Repeat exercise with own WSDL.