Professional Documents
Culture Documents
Plan
n Petit rappel sur les services Web n UDDI n DISCO n WSDL n SOAP n Dvelopper un service Web n Consommer un service Web n Divers
03/03/2003
03/03/2003
IP TC P/
Connectivit
FTP, E-ma il, Go pher
TML
Prsentation
Web P
Web
03/03/2003 3
03/03/2003
UDDI
Un protocole dinspection permet de localiser les documents lis un services Web dfini par son URL
n
DISCO
WSDL
5
03/03/2003
UDDI
Inspection
http:// www.ibuyspy.com/ibuyspy.disco Requte de demande dinformation
DISCO
Description
Demander la description du service Rponse : service description (XML)
WSDL
Web Service
http:// www.ibuyspy.com/ibuyspycs/InstantOrder.asmx?wsdl
Format dchange
Appel du service Rponse : retour du service demand (XML)
SOAP
03/03/2003
03/03/2003
n SOAP dfini une interface robuste pour HTTP/XML n Support de tous les types de donnes
03/03/2003
SOAP
n Un protocole simple pour changer des informations dans un
standards actuels
n n
n Les spcifications SOAP concernent n Le format des messages n Comment envoyer un message n Comment recevoir la rponse n Lencodage des donnes
03/03/2003 8
03/03/2003
SOAP
nest pas
n Un systme rparti objets n Pas de rfrences sur des objets n Pas de ramassage de miettes en rpartis n HTTP nest pas bi-directionnel n Par dactivation de service distance n Compliqu/simple ? n Ne veut pas rsoudre tous les problme du calcul distribus n Peut tre facilement implment
03/03/2003 9
SOAP
Point de vue :HTTP
n Requte HTTP Post
POST /WebCalculator/Calculator.asmx HTTP/1.1 Content-Type: text/xml SOAPAction: http://tempuri.org/Add Content-Length: 386 <?xml version=1.0?> <soap:Envelope ...> ... </soap:Envelope>
03/03/2003
10
03/03/2003
SOAP
Structure dun message // revoir
SOAP Message Headers SOAP Envelope SOAP Header Headers SOAP Body Message Name & Data
Le message SOAP Lentte indiquant le protocole de transport <Envelope> encloses payload <Header> encloses headers Individual headers <Body> contains SOAP message name XML-encoded SOAP message name & data
03/03/2003
11
SOAP
Format dun message SOAP
n Un document XML utilisant le schma SOAP
<?xml version=1.0?> <soap:Envelope ...> <soap:Header ...> ... </soap:Header> <soap:Body> <Add xmlns=http://tempuri.org/> <n1>12</n1> <n2>10</n2> </Add> </soap:Body> </soap:Envelope>
03/03/2003
12
03/03/2003
SOAP
Rponse du serveur
n Message de rponse du serveur
HTTP/1.1 200 OK ... Content-Type:text/xml Content-Length: 391 <?xml version=1.0?> <soap:Envelope ...> <soap:Body> <AddResult xmlns=http://tempuri.org/> <result>28.6</result> </AddResult> </soap:Body> </soap:Envelope>
03/03/2003
13
SOAP
Coder des donnes complexes
n Les structures de donnes sont srialises
en XML
<soap:Envelope ...> <soap:Body> <GetStockDataResult xmlns=http://tempuri.org/> <result> <Description>Plastic Novelties Ltd</Description> <Price>129</Price> <Ticker>PLAS</Ticker> </result> </GetStockDataRseult> </soap:Body> </soap:Envelope>
03/03/2003 14
03/03/2003
SOAP
Scurit
n Base sur HTTP n HTTPS n Certificats X.509 n Le dveloppeur choisi les mthodes quil
souhaite rendre publique n Il nest possible de transmettre du code n Peut traverser les Firewall n Typage
03/03/2003
15
SOAP
Tout le monde se lve pour
n DevelopMentor Inc. n Digital Creations n Microsoft
n IONA Technologies PLC n Rogue Wave Software Inc. n Scriptics Corp. n Jetform n ObjectSpace Inc. n Rockwell Software Inc. n SAP n Compaq n Secret Labs AB n Zveno Pty. Ltd. n IBM n Hewlett Packard n Intel n UserLand Software Inc.
03/03/2003
16
03/03/2003
SOAP
Exemple dune requte SOAP
POST /StockQuote HTTP/1.1 Host: www.stockquoteserver.com Content-Type: text/xml; charset="utf-8" Content-Length: nnnn SOAPAction: "Some-URI <SOAP-ENV:Envelope xmlns:SOAPENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV: encodingStyle = "http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <m:GetLastTradePrice xmlns:m="Some-URI"> <symbol>DIS</symbol> </m:GetLastTradePrice> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
03/03/2003
17
SOAP
Exemple dune rponse SOAP
HTTP/1.1 200 OK Content-Type: text/xml; charset="utf-8" Content-Length: nnnn <SOAP-ENV:Envelope xmlns:SOAP-ENV= "http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV: encodingStyle= "http://schemas.xmlsoap.org/soap/encoding/"/> <SOAP-ENV:Body> <m:GetLastTradePriceResponse xmlns:m="Some-URI"> <Price>34.5</Price> </m:GetLastTradePriceResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
03/03/2003
18
03/03/2003
SOAP
Example dune rponse SOAP ngative
HTTP/1.1 500 Internal Server Error Content-Type: text/xml; charset="utf-8" Content-Length: nnnn <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 Must Understand Error </faultstring> </SOAP-ENV:Fault> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
03/03/2003
19
WSDL
Web Services Description Language
n Schma XML pour dcrire des services Web 1. Dfinition de linterface du service
Abstrait la smantique du service Web Dfini lendroit ou le service peut tre appel (adresse IP, port, etc.)
2.
Dfinition du service
message concret
03/03/2003
20
10
03/03/2003
WSDL
Interface <definitions> <import> <types> <message> <portType> <binding>
03/03/2003 21
WSDL
Interface <definitions> <import> <types> <message> <portType> <binding>
03/03/2003
11
03/03/2003
WSDL
Implementation
<service> spcifie les dtails lis limplmentation <port> contient les adresses
03/03/2003
23
WSDL
n Demonstration :
http://localhost//math.asmx?WSDL
03/03/2003
24
12
03/03/2003
Inspection
DISCO
n Inspection lets you find Web Services on
a given site
n n n
A Web site publishes DISCO documents, which returns the URLs of WSDL descriptions DISCO documents can contain references to other sites and DISCO documents Dynamic discovery enables trees of directories to be searched
03/03/2003
25
UDDI
Overview
n UDDI = Universal Description, Discovery, and
n Specifications n Schema for service providers and descriptions n API for publishing and searching n Developed on industry standards (XML, HTTP, TCP/IP, SOAP) n Applies to both XML and non-XML services n Implementation n Public and private instances of specification
03/03/2003 26
13
03/03/2003
UDDI
The Vision
Advanced Discovery via Portals and Marketplaces Marketplace Marketplace Marketplace Search Portal Search Portal
Business Users
03/03/2003
Technical Users
27
UDDI
UDDI Information Model
Provider: Information about the entity who offers a service
0n
0n
Binding: Technical information about a service entry point and construction specs
03/03/2003
28
14
03/03/2003
UDDI
UDDI Schema
Interface Implementation <businessEntity> <businessService> <tModel> <bindingTemplate> <businessService> <tModel> <bindingTemplate>
03/03/2003
29
UDDI
How UDDI Works: tModel
n tModel = Technology Model n Generic meta-data structure to uniquely
represent any concept or construct n Also includes interface protocol definitions n Powerful abstraction modeling system n Examples: WSDL files, XML schema, namespaces, categorization schemes
03/03/2003
30
15
03/03/2003
UDDI
<tModel>
n <tModel> represents meta-data and
interfaces
<tModel xmlns="urn:uddi-org:api" tModelKey="UUID:AAAAAAAA-AAAAAAAA-AAAA-AAAAAAAAAAAA"> <name>microsoft-com:creditcheck</name> <description xml:lang="en">Check credit limits</description> <overviewDoc> <overviewURL>http://schema.com/creditcheck.wsdl </overviewURL> </overviewDoc> <categoryBag> <keyedReference tModelKey="UUID:CD153257-086A-4237-B336-6BDCBDCC6634" keyName="Consumer credit gathering or reporting services" keyValue="84.14.16.01.00"/> <keyedReference tModelKey="UUID:C1ACF26D-9672-4404-9D70-39B756E62AB4" keyName="types" keyValue="wsdlSpec"/> </categoryBag> </tModel>
03/03/2003 31
UDDI
Providers, Services And Bindings
n Providers n Examples: Accounting Department, Corporate Application Server n Name, Description, Contact Information n Categorization and Identification Information n Services n Examples: Purchase Order services, Payroll services n Name, Description(s) n Categorization Information n Bindings n Description(s), access points, parameters n Examples: Access Point (http://...) for Web Service
03/03/2003 32
16
03/03/2003
UDDI
<bindingTemplate>
n <bindingTemplate> represents data and
implementation details
<bindingTemplate serviceKey="33c3d124-e967-4ab1-8f51d93d95fac91a" bindingKey="48f2bc6b-a6de-4be8-9f2b2342aeafaaac"> <accessPoint URLType="http"> http://localhost/HelloWorld/Service1.asmx </accessPoint> <tModelInstanceDetails> <tModelInstanceInfo tModelKey="uuid:64c756d1-33744e00-ae83-ee12e38fae63/> </tModelInstanceDetails> </bindingTemplate>
03/03/2003
33
UDDI
Important UDDI Features
n Neutral in terms of protocols as a registry, it
can contain pointers to anything n Can search by business, service, Web Service (tModel), binding n Usage of Globally Unique Identifiers (GUIDs) n Specification allows public and private nodes n Delineation between interface and implementation
03/03/2003
34
17
03/03/2003
GXA
Global XML Web Services Architecture
Inter Application Protocols
Reliable Messaging
Discovery
Directory Inspection Description Referral Routing
Eventing
Transactions
XML
HTTP/SMTP
35
GXA
New Web Services Specifications
n WS-Inspection n Inspection n WS-Routing n Route messages over protocols n WS-Referral n Dynamic configuration of message routing n WS-Security n Credentials, integrity, confidentiality n WS-License n Signed user credentials
03/03/2003 36
18
03/03/2003
Plan
n Petit rappel sur les services Web n Dvelopper un service Web n En .Net bien sur n Consommer un service Web n Divers
03/03/2003
37
n n n n n
Lives in a virtual directory Can have a code-behind ASP.NET provides simple test harness ASP.NET automagically generates WSDL Can use .NET Framework classes and custom assemblies and classes
38
03/03/2003
19
03/03/2003
03/03/2003
40
20
03/03/2003
03/03/2003
41
Plan
n Petit rappel sur les services Web n Dvelopper un service Web n Consommer un service Web n Toujours en .Net n Divers
03/03/2003
42
21
03/03/2003
Service
n
Service Application
03/03/2003
44
22
03/03/2003
03/03/2003
45
03/03/2003
46
23
03/03/2003
03/03/2003
47
03/03/2003
48
24
03/03/2003
n n n
03/03/2003
49
03/03/2003
50
25
03/03/2003
out
Sample requests/responses
51
03/03/2003
03/03/2003
52
26
03/03/2003
Creates MathService.cs Contains MathService class, derived from SoapHttpClientProtocol in the System.Web.Services.Protocols namespace
n
to discover Web Services given a URL n This builds a proxy, and you can start using the Web Service immediately
n
03/03/2003
54
27
03/03/2003
03/03/2003
55
Plan
n Petit rappel sur les services Web n Dvelopper un service Web n Consommer un service Web n Divers
03/03/2003
56
28
03/03/2003
Miscellaneous
State Management
n Web Services are stateless n Use ASP.NET session state mechanism n What is a session?
n n
Restricted to a logical application Context in which a user communicates to a server Request identification and classification Store data across multiple requests Session events Release of session data
Functionality
n n n n
n
03/03/2003
Miscellaneous
Security Model
n Reasons for security n Prevent access to areas of your Web server n Record and store secure relevant user data n Security configuration n Authentication, Authorization, Impersonation
Web Client IIS ASP.NET App .NET OS
n Code Access Security n Are you the code you told me you are?
03/03/2003
58
29
03/03/2003
Miscellaneous
HTTP and Firewalls
U
Client Port 80
U
Firewall
03/03/2003
59
Miscellaneous
Secure Sockets Layer
Raw HTTP Client
<soap:Body> <AddResult xmlns= ...> <result>28.6</result> </AddResult> </soap:Body>
Web Service
SSL Client
<soap:Body> <AddResult xmlns= ...> <result>28.6</result> </AddResult> </soap:Body>
03/03/2003
Web Service
60
30
03/03/2003
Miscellaneous
Security Model
n Similar to securing a Web site n Clients are computers and businesses n Possible options with IIS n IPSec n Basic n Basic over SSL n Digest n Integrated n Client certificates n Passport?
03/03/2003 61
Miscellaneous
Transactions
n Like ASP.NET Web Forms n COM+ services n COM+ automatic transactions n atomic, consistent, isolated, durable (ACID)
SQL Server Application Web Service COM+ transaction context MSMQ Server
03/03/2003
62
31
03/03/2003
Miscellaneous
Transactions
n [WebMethod(Transaction=
03/03/2003
63
Miscellaneous
Execution Model
n Synchronous n Like any other call to class methods n Asynchronous n Split the method into two code blocks
n n
BeginMethodName EndMethodName
03/03/2003
64
32
03/03/2003
Miscellaneous
SOAP Toolkit
n An SDK for building Web Services using
Components allowing an ASP page to act as a facade for a COM object Wizard for generating WSDL descriptions from COM servers Client-side engine for dynamically creating an Automation proxy from WSDL
03/03/2003
65
Miscellaneous
SOAP Toolkit
n Available at
http://msdn.microsoft.com/downloads/def ault.asp?URL=/code/sample.asp?url=/msdn -files/027/001/580/msdncompositedoc.xml
Services through SOAP and schemas n Client infrastructure for Visual Studio n Focused on one way of creating Web Services
03/03/2003
66
33
03/03/2003
Miscellaneous
SOAP Toolkit
n Remote Object Proxy Engine (ROPE) n A set of COM components you can use to build SOAP messaging into your application n Client-side infrastructure to build Web Services n Server side infrastructure n Greatly simplifies SOAP programming n You can use SOAP without using ROPE
03/03/2003
67
n SOAP
http://msdn.microsoft.com/soap
n SOAP Specification
http://www.w3.org/TR/SOAP/
n Introduction to SOAP
http://www.w3.org/2000/xp/Group/Admin/minutes-oct1100 /soap-xp-wg_files/frame.htm
03/03/2003
68
34
03/03/2003
n UDDI
http://www.uddi.org http://uddi.microsoft.com
n HailStorm
http://www.microsoft.com/net/hailstorm.asp
03/03/2003
69
03/03/2003
70
35
03/03/2003
Programmer le Web
Code ct client et code ct serveur
Ct client Ct serveur n Code rcupr depuis un n Pourquoi du code ct serveur ? serveur Web et excut dans le n Accessibilit contexte dun navigateur pour n On peut accder aux tre excut sur le client informations depuis nimporte
n Pourquoi du code ct client ? n Permet la rpartition de la charge entre le client et le serveur n Crer des IHM plus sophistiques quen HTML n Animations n Validation des donnes par lutilisateur
n
quel browser, terminaux, nimporte quand, nimporte ou Il nest pas ncessaire de dployer le code applicatif Facilit pour faire voluer le code Le code nest pas diffus Uniquement les utilisateurs authentifi peuvent effectuer certaines actions Architecture 3 parties permettent la monte en charge
71
Administration
n n
Scurit
n n
Extensibilit
n
03/03/2003
Programmer le Web
Technologies client
n DHTML/JavaScript n COM n Contrle ActiveX n Composants COM n Remote Data Services (RDS) n Java n Plug-ins n Helpers n Remote Scripting
03/03/2003 72
36
03/03/2003
Programmer le Web
Dynamic HTML (DHTML)
n Encapsuler un script dans une page HTML n Gnralement crit en JavaScript (ECMAScript,
Internet Explorer supporte aussi VBScript et dautres langages de script Mozilla est extensible par plug-in
associ des vnements (i.e. onClick) n Les scripts fournissent du code qui sont excuter lors de la production dvnement de la part du navigateur
03/03/2003 73
Programmer le Web
DHTML
n Le DOM (Document Object Model) de DHTML
window
event
navigator
history
document
location
screen
frames
all
location
children
forms
selection
body
links
radio checkbox
textarea
select option
03/03/2003
74
37
03/03/2003
Programmer le Web
ActiveX
n Based on COM n Native only to Internet Explorer n Supported in Netscape with a plug-in n Good when you know your users (e.g.
03/03/2003
75
Programmer le Web
Java Applets
n Bas sur du bytecode Java n Portabilit garanti par les JVM : n Write once, run anywhere n Sr : le code sexcute dans un bac sable
03/03/2003
76
38
03/03/2003
Programmer le Web
Technologies server
n Common Gateway Interface (CGI) n Internet Server API (ISAPI) n Netscape Server API (NSAPI) n Active Server Pages (ASP) n Java Server Pages (JSP) n Personal Home Page (PHP) n Cold Fusion (CFM) n ASP.NET
03/03/2003
77
Programmer le Web
Active Server Pages (ASP)
n Technologie qui permet de
HTTP request
(form data, HTTP header data)
HTTP response
HTML, XML
un langage de script, gnralement VBScript ou JScript n Une page ASP contient une squence HTML statique dans laquelle est inclue le script excut par le serveur n Les scripts ASP permettent laccs et la modification de donnes (prsentes dans des BD)
03/03/2003
ASP page
(static HTML, server-side logic)
78
39