Web Services


Web Services: Introduction

SOAP: Simple Object Access Protocol

"SOAP Version 1.2 provides the definition of the XML-based information which can be used for exchanging structured and typed information between peers in a decentralized, distributed environment." [W3C]

  • SOAP is a communication protocol
  • SOAP is for communication between applications
  • SOAP is a format for sending messages
  • SOAP is designed to communicate via Internet
  • SOAP is platform independent
  • SOAP is language independent
  • SOAP is based on XML
  • SOAP is simple and extensible
  • SOAP allows you to get around firewalls
  • SOAP will be developed as a W3C standard

from suds.client import Client
client = Client('http://www.restfulwebservices.net/wcf/StockQuoteService.svc?wsdl')
print client.GetStockQuote('AMZN')

client = Client('http://www.restfulwebservices.net/wcf/CurrencyService.svc?wsdl')
print client.service.GetConversionRate('USD', 'CAD')
print client.service.GetConversionRate('CAD', 'JPY')

client = Client('http://webservices.tekever.eu/ip2pais/?wsdl ')
print client.service.IP2Pais('')

Python (2.6) example with suds-0.3.7

from suds.client import Client
client = Client("http://www.ecubicle.net/iptocountry.asmx?wsdl")
result = client.service.FindCountryAsString("")
print result

Python (2.0) examples (with SOAP.py):
import SOAP

from SOAPpy import SOAPProxy
server = SOAP.SOAPProxy("http://services.xmethods.net/soap")
print server._ns("urn:xmethods-delayed-quotes").getQuote(symbol = "AMZN")
server = SOAP.SOAPProxy("http://services.xmethods.net/soap")
print server._ns("urn:xmethods-CurrencyExchange").getRate(country1="usa", country2="canada")
print server._ns("urn:xmethods-CurrencyExchange").getRate(country1="usa", country2="japan")
server = SOAP.SOAPProxy("http://services.xmethods.net:80/perl/soaplite.cgi")
print server._ns("urn:xmethodsBabelFish").BabelFish(translationmode="en_fr", sourcedata="soap is good for translation")
A simple "Hello World" http SOAP server:

import SOAPpy
def hello():
return "Hello World"

server = SOAPpy.SOAPServer(("localhost", 8080))

And the corresponding client:

import SOAPpy
server = SOAPpy.SOAPProxy("http://localhost:8080/")
print server.hello()

WSDL: Web Services Description Language

  • Describe XML-based services
  • A collection of metadata about an XML-based service
  • Desribes functionality and how that functionality is made available.
  • Most prominent current use of WSDL is to describe services by SOAP
  • WSDL Version 2.0 (W3C)

UDDI: Universal Description, Discovery and Integration

  • A specification for distributed Web-based information registries of Web services.
  • A publicly accessible registries of services
  • Allow businesses to register information about the Web services they offer so that other busines can find them
  • uddi.xml.org

RESTful (Representational State Transfer)

last.fm: http://www.last.fm/api/intro

  • http://ws.audioscrobbler.com/2.0/?method=artist.getSimilar&artist=Madonna&api_key=

Echonest: http://developer.echonest.com

  • http://developer.echonest.com/api/v4/artist/similar?api_key=FILDTEOIK2HBORODV&name=Madonna

Adobe Flex Demo

Audio on HTML5

Created: 2003.01.07 Modified: Ichiro Fujinaga
McGill Crest