Download presentation
Presentation is loading. Please wait.
Published byTheodora Burke Modified over 9 years ago
1
WEB 服务初级编程 祝伟华 网络新型服务技术中心
2
内容 分布式计算 互联网分布式计算标准 定义 发布 使用 其它特性
3
分布式计算 Procedure Call Remote Procedure Call (RPC) Tuxedo CORBA RMI/IIOP/EJB – 基于浏览器客户端分布式计算 –Rich Client –JAVA APPLET –JAVASCRIPT/AJAX COM/COM+/DNA Web Service/SOAP/SOA
4
互联网分步式计算 Internet Application Devices, Browsers OS and local services Vertical and portal service App-specific Web Service Building block Web Service Access Application Call Services Web Services Contract
5
基于互联网分布式计算标准 HTTP XML SOAP (Simple Object Access Protocol) Web Service Description Language (WSDL) DISCO UDDI (Universal Discovery, Description, and Integration )
6
WEB 服务架构 Web Service Client Discovery Request disco Return disco (XML) Description Request WSDL Return WSDL (XML) Protocol Request.asmx Return response (XML)
7
定义 WebService Directive ( 页面定义 ) –Settings for ASP.NET compilers WebMethod Attribute ( 后台代码定义 ) Code Declaration Syntax –Outline –Inline (in C#) using System.Web.Services; public class MathService : WebService { [ WebMethod ]...
8
定义 using System; using System.Web.Services; public class MathService { [WebMethod] public int Subtract(int a, int b) { return a - b; } public int Subtract_vs(int a, int b) { return b - a; } }
9
发布 Expose Web Service and Web Service methods Create a Web Service proxy and an assembly –Generate proxy with WebServiceUtil tool –Create an assembly –Enables developers to program against Web Services Publish WSDL contract and HTML description Web Service clients –Can be Web applications or browsers 思考 : 代理类, SOAP 协议间数据如何传递和转换 ?
10
发现.disco file –XML-based file containing links to resources for retrieving WSDL –Stored in the server‘s root directory –Access via URL and dynamic discovery document –Start discovering with the WebServiceUtil tool –Automatically created by Visual Studio.NET Global directory of Web Services through UDDI –Universal Discovery, Description, and Integration (http://www.uddi.org)
11
使用 Web Service Developer Web Application Developer Web Server 1 Service App asmx.aspx Web Server 2 Service App ProxyWeb Form
12
使用 Create client proxy class Input: –WSDL contract –Proxy language and protocol Output: –Single source file in specified language, containing: Proxy class Code for network invocation and marshalling Command-line example: webserviceutil /c:proxy /l:C# /namespace:MathServiceSpace MathService.sdl
13
使用 Request without method name and parameters –HTML description of Web Service –Service capabilities, methods, protocols Web Service can return WSDL –HTTP-GET, HTTP-POST, and HTTP-SOAP Request with parameter “?SDL” –Formal WSDL description of Web Service –XML-based grammar –Can be used as input for WebServiceUtil.exe
14
使用 ( 通过 HTTP 协议 ) Web Services are URL addressable –HTTP request Protocols –HTTP-GET Method name and arguments in URL –HTTP-POST Method name and arguments in POST body –HTTP-SOAP XML grammar for –Addressing the Web Service –Returning results
15
使用 (HTTP/GET/POST) http://server/appl/service.asmx/method?para m=value Standard HTTP-GET –Method name = PATHINFO –Method arguments = URL query string Query string key = parameter name Multiple parameters Only primitive.NET runtime data types –Result is an XML document Any.NET data type HTTP-POST –Similar to GET, but with arguments in the form body
16
使用 (HTTP/SOAP 调用 ) XML grammar for –Web Service method, method parameters, results Supports all standard.NET data types and value classes –Additionally: classes, structs, datasets Class and struct marshalling –Serialization in XML format
17
WSDL XML grammar, defining: –Services and ports that communicate via messages –Binding Specify a protocol or a data format for a message or a port Extensions for SOAP 1.1, HTTP GET/POST, and MIME Public description of a Web Service and its content –WSDL contract Core Elements of WSDL –service, port, and portType –operations and messages
18
WSDL
19
高级特性 状态管理 安全性 事务处理
20
SOA Service Oriented Architecture EAI (Enterprise Application Integration)
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.