Web Services

balecomputerΑσφάλεια

3 Νοε 2013 (πριν από 3 χρόνια και 10 μήνες)

86 εμφανίσεις

Web Services

CS 6580

Web Services


Internet
-
available services using XML
messaging, for computer
-
computer interaction


Not tied to any OS or language


Self
-
describing: public interface published, in
XML


Discoverable: yellow pages to find services
and interface descriptions

The “Automated Web”


Standards mean lower barrier to application
integration, possibly “just
-
in
-
time”

Application

Service

Registry

Web Server

Service Description

Web Service

1. Discover services

2. Retrieve Service Description

3. Invoke remote service

Protocol Stack

Discovery: UDDI

Description: WSDL

XML messaging: SOAP, XML
-
RPC, REST

Transport: HTTP, SMTP, FTP, BEEP

XML
-
RPC


Simple


Request: in XML, sent via HTTP POST


Reply: XML in HTTP response


Sample request (minus HTTP headers)


<?xml version="1.0" encoding="ISO-8859-1" ?>
<methodCall>
<methodName>weather.getWeather</methodName>
<params>
<param><value>94542</value></param>
</params>
</methodCall>
XML
-
RPC response


Response, minus HTTP headers:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<methodResonse>
<params>
<param> <value><int>65</int></value>
</param>
</params>
</methodResponse>
REST


Representational State
Transfer (aka XML/HTTP)


Simpler


Request: via HTTP GET, parameters in URL


Result: XML


Ex) Visit http://www.amazon.com/webservices

GET
/onca/xml?Service=AWSECommerceService&SubscriptionId=
15YAMHAMKKB9NK19SQ82&Operation=ItemSearch&Search
Index=SportingGoods&Keywords=golf%20club%20Callaway


(send above to webservices.amazon.com port 80 using telnet)


SOAP


Simple Object Access
Protocol


Complex


Request and Reply in XML, over various protocols,
usually HTTP


SOAP


sample request

P O S T /s e a r c h/b e t a 2 H T T P/1.1
H o s t: a p i.g o o g l e.c o m
C o n t e n t - t y p e: t e x t/x m l
C o n t e n t - l e n g t h: 9 7 2
S O A P A c t i o n: h t t p://a p i.g o o g l e.c o m
<?x m l v e r s i o n ='1.0' e n c o d i n g ='U T F - 8'?>
< S O A P - E N V:E n v e l o p e x m l n s:S O A P - E N V ="h t t p://s c h e m a s.x m l s o a p.o r g/s o a p/e n v e l o p e/"
x m l n s:x s i ="h t t p://w w w.w 3.o r g/1 9 9 9/X M L S c h e m a - i n s t a n c e"
x m l n s:x s d ="h t t p://w w w.w 3.o r g/1 9 9 9/X M L S c h e m a">
< S O A P - E N V:B o d y >
< n s 1:d o G o o g l e S e a r c h x m l n s:n s 1 ="u r n:G o o g l e S e a r c h"
S O A P - E N V:e n c o d i n g S t y l e ="h t t p://s c h e m a s.x m l s o a p.o r g/s o a p/e n c o d i n g/">
< k e y x s i:t y p e ="x s d:s t r i n g"> o r i e h l k s a j h f o s i 3 9 8 4 6 8 s 9 8 w </k e y >
< q x s i:t y p e ="x s d:s t r i n g"> s h r d l u w i n o g r a d m a c l i s p t e l e t y p e </q >
< s t a r t x s i:t y p e ="x s d:i n t"> 0 </s t a r t >
< m a x R e s u l t s x s i:t y p e ="x s d:i n t"> 1 0 </m a x R e s u l t s >
< f i l t e r x s i:t y p e ="x s d:b o o l e a n"> t r u e </f i l t e r >
< r e s t r i c t x s i:t y p e ="x s d:s t r i n g"> </r e s t r i c t >
< s a f e S e a r c h x s i:t y p e ="x s d:b o o l e a n"> f a l s e </s a f e S e a r c h >
< l r x s i:t y p e ="x s d:s t r i n g"> </l r >
< i e x s i:t y p e ="x s d:s t r i n g"> l a t i n 1 </i e >
< o e x s i:t y p e ="x s d:s t r i n g"> l a t i n 1 </o e >
</n s 1:d o G o o g l e S e a r c h >
</S O A P - E N V:B o d y >
</S O A P - E N V:E n v e l o p e >
Service Description: WSDL (Web
Services Description Language)

An XML file containing:


Public functions


Data types


Binding info about protocol to use


Address info for service


(Extensions for SOAP)

Service Discovery: UDDI (Universal
Description, Discovery, and
Integration of Web Services)


UDDI has 2 parts:


A technical spec for a distributed directory of businesses and
web services


Data stored in XML


API for searching


UDDI Business Registry: an implementation of UDDI spec


White pages: general info (address, phone no., etc)


Yellow pages: classification based on industry,product,etc


Green pages: tech info about a web service (SOAP, CORBA,
Java RMI)