dev371 visual studio 2005 + wse 3.0 web services 开发的强大平台 杨滔 developer evangelist...

39
DEV371 DEV371 Visual Studio 2005 + WSE Visual Studio 2005 + WSE 3.0 3.0 Web Services Web Services 开开开开开开开 开开开开开开开 杨杨 杨杨 Developer Evangelist Developer Evangelist 杨杨杨杨杨 杨杨杨杨杨 杨杨杨杨杨杨 杨杨杨杨杨杨

Upload: nathan-lynch

Post on 17-Jan-2016

324 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: DEV371 Visual Studio 2005 + WSE 3.0 Web Services 开发的强大平台 杨滔 Developer Evangelist 合作开发部微软有限公司

DEV371DEV371Visual Studio 2005 + WSE Visual Studio 2005 + WSE 3.03.0Web ServicesWeb Services 开发的强大平台开发的强大平台

杨滔杨滔Developer EvangelistDeveloper Evangelist合作开发部合作开发部微软有限公司微软有限公司

Page 2: DEV371 Visual Studio 2005 + WSE 3.0 Web Services 开发的强大平台 杨滔 Developer Evangelist 合作开发部微软有限公司
Page 3: DEV371 Visual Studio 2005 + WSE 3.0 Web Services 开发的强大平台 杨滔 Developer Evangelist 合作开发部微软有限公司

日程日程

人们所期望的人们所期望的 Web ServiceWeb Service

.NET Framework 2.0 + WSE 3.0.NET Framework 2.0 + WSE 3.0简便的开发安全的简便的开发安全的 Web ServiceWeb Service

简化面向服务的应用的开发简化面向服务的应用的开发通向通向 IndigoIndigo 的必经之路的必经之路

IndigoIndigo ,天下归一,天下归一

Page 4: DEV371 Visual Studio 2005 + WSE 3.0 Web Services 开发的强大平台 杨滔 Developer Evangelist 合作开发部微软有限公司

什么是 什么是 Web ServicesWeb Services

一组为实现丰富和可互操作的通讯的协议和规范一组为实现丰富和可互操作的通讯的协议和规范通常称作 通常称作 WS-* WS-* 规范规范

规范由规范由 MicrosoftMicrosoft 和其他业界企业一起制定和其他业界企业一起制定例如 例如 IBM and BEAIBM and BEA

与传输层无关与传输层无关可以使用 可以使用 HTTP, TCPHTTP, TCP 等等等等 ..

可组合性可组合性只使用和应用相关的协议和规范只使用和应用相关的协议和规范

Page 5: DEV371 Visual Studio 2005 + WSE 3.0 Web Services 开发的强大平台 杨滔 Developer Evangelist 合作开发部微软有限公司

Web Service Architecture - Web ServiceWeb Service Architecture - Web Service

全貌全貌

基础

应用和应用基础设施

传输层

Connected Applications Managemen

t

BusinessProcess

Security

Reliability

Transactions

Messaging

XML

Meta

data

HTTP

TCP SMTP

Page 6: DEV371 Visual Studio 2005 + WSE 3.0 Web Services 开发的强大平台 杨滔 Developer Evangelist 合作开发部微软有限公司

Evolve and ExtendSecure, Reliable, TransactedFundamentals

20032000 2001 2002 2004 2005

WS-ReliableMessagingWS-ReliableMessaging

Relia

bility

Relia

bility

WS-I formedWS-I formed

Inte

rop

era

bility

Inte

rop

era

bility

WS-I BP 1.0WS-I BP 1.0

Security RoadmapSecurity Roadmap

Wh

itep

ap

ers

Wh

itep

ap

ers

Reliable Messaging RoadmapReliable Messaging RoadmapSRT Web Services WhitepaperSRT Web Services Whitepaper

WS-SecurityWS-Security

WS-TrustWS-Trust

Secu

rityS

ecu

rity

WS-Security AddendumWS-Security Profile for Tokens

WS-Security AddendumWS-Security Profile for Tokens

WS-FederationWS-Federation Active Requestor Profile

WS-FederationWS-Federation Active Requestor Profile

WS-Security SOAP Message SecurityWS-Security Username Token ProfileWS-Security X.509 Certificate Token Profile

WS-Security SOAP Message SecurityWS-Security Username Token ProfileWS-Security X.509 Certificate Token Profile

WS-Security Kerberos BindingWS-Security Kerberos Binding

WS-CoordinationWS-Transaction

WS-CoordinationWS-Transaction

Tra

nsa

ction

sTra

nsa

ction

s

WS-AtomicTransactionWS-AtomicTransaction

WS-BusinessActivityWS-BusinessActivity

SOAP 1.1SOAP 1.1

Messa

gin

gM

essa

gin

g

SOAP Messages with Attachments

SOAP Messages with Attachments

WS-ReferralWS-Routing

WS-ReferralWS-Routing

DIMEDIME WS-AttachmentsWS-Attachments

WS-AddressingWS-AddressingSOAP 1.2SOAP 1.2

MTOMMTOMWS-EventingWS-Eventing

WS-Policy 1.1WS-PolicyAttachments 1.1WS-PolicyAssertions 1.1

WS-Policy 1.1WS-PolicyAttachments 1.1WS-PolicyAssertions 1.1

WS-PolicyWS-PolicyAttachmentsWS-PolicyAssertionsWS-SecurityPolicy

WS-PolicyWS-PolicyAttachmentsWS-PolicyAssertionsWS-SecurityPolicy

Meta

data

Meta

data

UDDI 1.0UDDI 1.0

WSDLWSDLUDDI 2.0UDDI 2.0

WS-InspectionWS-InspectionUDDI 3.0UDDI 3.0

WS-DiscoveryWS-MetadataExchange

WS-DiscoveryWS-MetadataExchange

As of 2/2004

Page 7: DEV371 Visual Studio 2005 + WSE 3.0 Web Services 开发的强大平台 杨滔 Developer Evangelist 合作开发部微软有限公司

.NET Web Services.NET Web Services

ASMXASMX 是是 .NET Framework.NET Framework 对基本对基本Web ServiceWeb Service 的实现的实现

支持基本的支持基本的 Web ServiceWeb Service没有实现 没有实现 WS-* WS-* 规范规范

WSEWSE 是对 是对 .NET Framework.NET Framework 的扩展的扩展可以扩展可以扩展 ASMXASMX 的行为的行为支持部分支持部分 WS-*WS-* 规范规范

IndigoIndigo 是新一代的是新一代的 Web serviceWeb service 的实的实现现

对对 WS-*, messaging, queuing, WS-*, messaging, queuing, transactionstransactions 提供统一的编程模型提供统一的编程模型

Page 8: DEV371 Visual Studio 2005 + WSE 3.0 Web Services 开发的强大平台 杨滔 Developer Evangelist 合作开发部微软有限公司

Web Services ArchitectureWeb Services ArchitectureASP.NET Web ServicesASP.NET Web Services

Connected Applications Managemen

t

BusinessProcess

Security

Reliability

Transactions

Messaging

XML

Meta

data

HTTP

TCP SMTP

基础

应用和应用基础设施

传输层

Page 9: DEV371 Visual Studio 2005 + WSE 3.0 Web Services 开发的强大平台 杨滔 Developer Evangelist 合作开发部微软有限公司

Web Services ArchitectureWeb Services ArchitectureWeb Services Enhancements 3.0Web Services Enhancements 3.0

Connected Applications Managemen

t

BusinessProcess

Security

Reliability

Transactions

Messaging

XML

Meta

data

HTTP

TCP SMTP

基础

应用和应用基础设施

传输层

Page 10: DEV371 Visual Studio 2005 + WSE 3.0 Web Services 开发的强大平台 杨滔 Developer Evangelist 合作开发部微软有限公司

WSE 3.0WSE 3.0 和和 VS 2005VS 2005 的集成的集成

WSE3.0WSE3.0 工具集成到工具集成到 Visual Studio Visual Studio 20052005 开发环境中开发环境中扩展了扩展了 ASMX ASMX 的编程模型的编程模型

Alternative transports e.g. TCPAlternative transports e.g. TCP

Hosting environments e.g. Console Hosting environments e.g. Console appsapps

Messaging APIs remainMessaging APIs remainSoapClient, SoapServiceSoapClient, SoapService

Page 11: DEV371 Visual Studio 2005 + WSE 3.0 Web Services 开发的强大平台 杨滔 Developer Evangelist 合作开发部微软有限公司

VS2005 VS2005 和 和 WSE 3.0WSE 3.0 集集成成

Page 12: DEV371 Visual Studio 2005 + WSE 3.0 Web Services 开发的强大平台 杨滔 Developer Evangelist 合作开发部微软有限公司

目标目标

开发安全、功能丰富的开发安全、功能丰富的Web ServiceWeb Service

简化面向服务的应用的开发简化面向服务的应用的开发

.NET Framework v2.0.NET Framework v2.0 WSE v3.0WSE v3.0

通向通向 IndigoIndigo

IndigoIndigo

Page 13: DEV371 Visual Studio 2005 + WSE 3.0 Web Services 开发的强大平台 杨滔 Developer Evangelist 合作开发部微软有限公司

Web Services ArchitectureWeb Services ArchitectureWeb Services Enhancements 3.0Web Services Enhancements 3.0

Connected Applications Managemen

t

BusinessProcess

Reliability

Transactions

Messaging

XML

Meta

data

HTTP

TCP SMTP

基础

应用和应用基础设施

传输层

Security

Page 14: DEV371 Visual Studio 2005 + WSE 3.0 Web Services 开发的强大平台 杨滔 Developer Evangelist 合作开发部微软有限公司

安全性是安全性是 WSEWSE 的首要目标的首要目标

支持如下支持如下 WS-*WS-* 规范规范WS-SecurityWS-Security

WS-TrustWS-Trust

WS-WS-SecureConversationSecureConversation

Page 15: DEV371 Visual Studio 2005 + WSE 3.0 Web Services 开发的强大平台 杨滔 Developer Evangelist 合作开发部微软有限公司

安全的通讯安全的通讯传输层的安全性传输层的安全性

发送者必须信任中介发送者必须信任中介消息在中介处需要解密消息在中介处需要解密整条信息加密整条信息加密仅能使用有限的传输协议仅能使用有限的传输协议

EncryptedEncrypted EncryptedEncrypted

Page 16: DEV371 Visual Studio 2005 + WSE 3.0 Web Services 开发的强大平台 杨滔 Developer Evangelist 合作开发部微软有限公司

安全的通讯安全的通讯消息级别的安全性消息级别的安全性

与传输层无关的端到端的安全性与传输层无关的端到端的安全性支持多种加密技术支持多种加密技术可以加密消息的某一部分可以加密消息的某一部分发送者只需信任最终的接受者发送者只需信任最终的接受者The signature is stored with the The signature is stored with the datadata

Page 17: DEV371 Visual Studio 2005 + WSE 3.0 Web Services 开发的强大平台 杨滔 Developer Evangelist 合作开发部微软有限公司

Turnkey Security ScenarioTurnkey Security ScenarioUsernameOverCertificateUsernameOverCertificate

Application Application ServerServer

InternetInternet IntranetIntranet

Authenticate Authenticate username/ username/ PasswordPassword

Confidential, signedConfidential, signedrequest using a client keyrequest using a client keyprotected with theprotected with theserver certificateserver certificate

Confidential, signedConfidential, signedresponse using response using the supplied client keythe supplied client key

Username/Password Username/Password for Authenticationfor Authentication

Page 18: DEV371 Visual Studio 2005 + WSE 3.0 Web Services 开发的强大平台 杨滔 Developer Evangelist 合作开发部微软有限公司

Turnkey Security ScenariosTurnkey Security Scenarios基于业界的最佳实践基于业界的最佳实践Each scenario represented as an Each scenario represented as an assertionassertion

UsernameOverCertificateUsernameOverCertificate

AnnonymousOverCertificateAnnonymousOverCertificate

UsernameOverTransportUsernameOverTransport

KerberosKerberos

MutualCertificateMutualCertificate

Page 19: DEV371 Visual Studio 2005 + WSE 3.0 Web Services 开发的强大平台 杨滔 Developer Evangelist 合作开发部微软有限公司

Security with WSE 3.0Security with WSE 3.0

Page 20: DEV371 Visual Studio 2005 + WSE 3.0 Web Services 开发的强大平台 杨滔 Developer Evangelist 合作开发部微软有限公司

Web Services ArchitectureWeb Services ArchitectureWeb Services Enhancements 3.0Web Services Enhancements 3.0

Connected Applications Managemen

t

BusinessProcess

Security

Reliability

Transactions

Messaging

XML

Meta

data

HTTP

TCP SMTP

基础

应用和应用基础设施

传输层

Page 21: DEV371 Visual Studio 2005 + WSE 3.0 Web Services 开发的强大平台 杨滔 Developer Evangelist 合作开发部微软有限公司

WSE 3.0WSE 3.0 支持支持 WS-PolicyWS-Policy

Describes requirements for incoming Describes requirements for incoming and outgoing messages as policy and outgoing messages as policy assertionsassertions

Limitations of Policy in WSE 2.0Limitations of Policy in WSE 2.0Request and response messages secured Request and response messages secured separatelyseparately

Made to think in low level termsMade to think in low level terms

Policy files are simplifiedPolicy files are simplifiedSimplifies security through the turnkey Simplifies security through the turnkey security assertions security assertions

New object model for policyNew object model for policy// Set the ClientPolicy onto the proxy// Set the ClientPolicy onto the proxy

serviceProxy.SetPolicy("ClientPolicy");serviceProxy.SetPolicy("ClientPolicy");

Page 22: DEV371 Visual Studio 2005 + WSE 3.0 Web Services 开发的强大平台 杨滔 Developer Evangelist 合作开发部微软有限公司

Service Orientation TenetsService Orientation Tenets

1.1. Services are autonomousServices are autonomous

2.2. Boundaries are explicitBoundaries are explicit

3.3. Services share schemas not typesServices share schemas not types

4.4. Compatibility based on policyCompatibility based on policy

Page 23: DEV371 Visual Studio 2005 + WSE 3.0 Web Services 开发的强大平台 杨滔 Developer Evangelist 合作开发部微软有限公司

Security PolicySecurity Policy

PolicyPolicy• Only accept Only accept Username/Password Username/Password for authentication, for authentication, signed and encrypted signed and encrypted with server certificatewith server certificate

• Only callers who are Only callers who are in the Manager rolein the Manager role

PolicyPolicy• Only accept Only accept KerberosKerberosauthenticationauthentication

Security is a deployment Security is a deployment considerationconsideration

Page 24: DEV371 Visual Studio 2005 + WSE 3.0 Web Services 开发的强大平台 杨滔 Developer Evangelist 合作开发部微软有限公司

Policy Pipeline ArchitecturePolicy Pipeline Architecture

Policy describes an input pipelinePolicy describes an input pipeline

Input Input Soap MessageSoap Message S

ecu

rityS

ecu

rity

Tra

cing

Tra

cing

Cu

sto

mC

us

tom

Se

curity

Se

curity

Tra

cing

Tra

cing

Cu

sto

mC

us

tom

ApplicationApplicationProcessingProcessing

OutputOutputSoap MessageSoap Message

Policy assertions Policy assertions transform the messagetransform the message

… … and an output Pipelineand an output Pipeline

Page 25: DEV371 Visual Studio 2005 + WSE 3.0 Web Services 开发的强大平台 杨滔 Developer Evangelist 合作开发部微软有限公司

Security with PolicySecurity with Policy

Page 26: DEV371 Visual Studio 2005 + WSE 3.0 Web Services 开发的强大平台 杨滔 Developer Evangelist 合作开发部微软有限公司

Web Services ArchitectureWeb Services ArchitectureWeb Services Enhancements 3.0Web Services Enhancements 3.0

Connected Applications Managemen

t

BusinessProcess

Security

Reliability

Transactions

Messaging

XML

Meta

data

HTTP

TCP SMTP

基础

应用和应用基础设施

传输层

Page 27: DEV371 Visual Studio 2005 + WSE 3.0 Web Services 开发的强大平台 杨滔 Developer Evangelist 合作开发部微软有限公司

MTOMMTOM

Message Transmission Message Transmission Optimization Mechanism Optimization Mechanism (MTOM)(MTOM)

MTOMMTOM 取代了对取代了对 DIME & WS-DIME & WS-AttachmentsAttachments

益处益处和 和 WS-Security WS-Security 可以保护传输的数据可以保护传输的数据简化的变成模型简化的变成模型减少消息的大小减少消息的大小

SecuritySecurity

SimplifySimplify

ReductionReduction

Page 28: DEV371 Visual Studio 2005 + WSE 3.0 Web Services 开发的强大平台 杨滔 Developer Evangelist 合作开发部微软有限公司

使用使用 MTOMMTOM 传输大数据传输大数据

Page 29: DEV371 Visual Studio 2005 + WSE 3.0 Web Services 开发的强大平台 杨滔 Developer Evangelist 合作开发部微软有限公司

Web Services ArchitectureWeb Services ArchitectureWeb Services Enhancements 3.0Web Services Enhancements 3.0

Connected Applications Managemen

t

BusinessProcess

Security

Reliability

Transactions

Messaging

XML

Meta

data

HTTP

TCP SMTP

基础

应用和应用基础设施

传输层

Page 30: DEV371 Visual Studio 2005 + WSE 3.0 Web Services 开发的强大平台 杨滔 Developer Evangelist 合作开发部微软有限公司

Extend ASMX programming Model Extend ASMX programming Model Example: ASMX Web Service over TCP

public class StockServicepublic class StockService System.Web.Services.WebServiceSystem.Web.Services.WebService {{

[WebMethod][WebMethod]public StockQuote[] StockQuoteRequest([string[] public StockQuote[] StockQuoteRequest([string[]

symbols) {symbols) { } } }}

static void Main(string[] args)static void Main(string[] args) {{

Uri to = new Uri( "soap.tcp://StockService/StockQuote");Uri to = new Uri( "soap.tcp://StockService/StockQuote");EndpointReference EPR = new EndpointReference(to);EndpointReference EPR = new EndpointReference(to);SoapReceivers.Add (EPR, typeof (StockService));SoapReceivers.Add (EPR, typeof (StockService));

}}

Page 31: DEV371 Visual Studio 2005 + WSE 3.0 Web Services 开发的强大平台 杨滔 Developer Evangelist 合作开发部微软有限公司

Web Service via TCPWeb Service via TCP

Page 32: DEV371 Visual Studio 2005 + WSE 3.0 Web Services 开发的强大平台 杨滔 Developer Evangelist 合作开发部微软有限公司

Web Services ArchitectureWeb Services ArchitectureIndigo Web ServicesIndigo Web Services

Foundation

Applications & ApplicationInfrastructure

Transports

Connected Applications Managemen

t

BusinessProcess …

Security

Reliability

Transactions

Messaging

XML

Meta

data

HTTP

TCP SMTP

Page 33: DEV371 Visual Studio 2005 + WSE 3.0 Web Services 开发的强大平台 杨滔 Developer Evangelist 合作开发部微软有限公司

天下归一天下归一

互操作性跨平台

ASMX

分布式事务…

Enterprise Services

对 WS-* 规范的支持

WSE

消息队列

System.Messaging

.NET 与 .NET 之间通讯

.NET Remoting

Page 34: DEV371 Visual Studio 2005 + WSE 3.0 Web Services 开发的强大平台 杨滔 Developer Evangelist 合作开发部微软有限公司

IndigoIndigo 中的统一编程模型中的统一编程模型

Page 35: DEV371 Visual Studio 2005 + WSE 3.0 Web Services 开发的强大平台 杨滔 Developer Evangelist 合作开发部微软有限公司

Side-by-side co-Side-by-side co-existence with existence with existing distributed existing distributed technologiestechnologies

Seamless Seamless communication with communication with applications built on applications built on existing technologiesexisting technologies

Smooth upgrade of Smooth upgrade of existing code to existing code to IndigoIndigo

通向通向 IndigoIndigoLeveraging Existing Microsoft InvestmentsLeveraging Existing Microsoft Investments

ASMXASMX

ASMXASMX

ASMXASMX ESES WSE3WSE3

Page 36: DEV371 Visual Studio 2005 + WSE 3.0 Web Services 开发的强大平台 杨滔 Developer Evangelist 合作开发部微软有限公司

1.1. 如果开发分布式应用首选如果开发分布式应用首选 Web Web ServiceService

2.2. 如果开发基本的如果开发基本的 Web Service,Web Service, 使用使用ASMXASMX

3.3. 如果需要支持如果需要支持 WS-*WS-* ,使用,使用 WSE3.0WSE3.0

4.4. 开始关注开始关注 IndigoIndigo

Page 37: DEV371 Visual Studio 2005 + WSE 3.0 Web Services 开发的强大平台 杨滔 Developer Evangelist 合作开发部微软有限公司

http://msdn.microsoft.com/http://msdn.microsoft.com/webserviceswebservices

http://www.microsoft.com/http://www.microsoft.com/china/msdn/china/msdn/

Page 38: DEV371 Visual Studio 2005 + WSE 3.0 Web Services 开发的强大平台 杨滔 Developer Evangelist 合作开发部微软有限公司

问题问题

1.1. 例举例举 WSE3.0WSE3.0 中支持的中支持的 WS-*WS-* 规范规范2.2. 例举例举 SOASOA 的四大特点的四大特点3.3. 什么是什么是 MTOMMTOM

Page 39: DEV371 Visual Studio 2005 + WSE 3.0 Web Services 开发的强大平台 杨滔 Developer Evangelist 合作开发部微软有限公司