22
1 Using XSD, CLR Types, And Serialization In Web Services Doug Purdy Program Manager Microsoft Corporation [email protected] WSV303 WSV303

1 Using XSD, CLR Types, And Serialization In Web Services Doug Purdy Program Manager Microsoft Corporation [email protected] Doug Purdy Program Manager

Embed Size (px)

Citation preview

1

Using XSD, CLR Types, And Serialization In Web Services

Doug PurdyProgram ManagerMicrosoft [email protected]

WSV303

WSV303

2

Tools

Client Application Model

Avalon Windows Forms

Web & Service Application Model

ASP.NET / Indigo Win FSCompact

FrameworkYukon Mobile PC Optimized

System.HelpSystem.Help

System.DrawingSystem.Drawing

System.NaturalLanguageServicesSystem.NaturalLanguageServices

Data Systems Application Model

Presentation Data

Mobile PC & Devices Application Model

Communication

Command Line

NT Service

DataSetDataSet

MappingMapping

ObjectSpacesObjectSpaces

ObjectSpaceObjectSpace

QueryQuery

SchemaSchema

ItemItem

RelationshipRelationship

MediaMedia

AudioAudio

VideoVideo

ImagesImages

System.MessagingSystem.Messaging System.DiscoverySystem.Discovery

System.DirectoryServicesSystem.DirectoryServices

System.RemotingSystem.Remoting

System.Runtime.RemotingSystem.Runtime.Remoting

ActiveDirectoryActiveDirectory

UddiUddi

System.Web.ServicesSystem.Web.Services

Web.ServiceWeb.Service

DescriptionDescription

DiscoveryDiscovery

ProtocolsProtocols

System.MessageBusSystem.MessageBus

TransportTransport

PortPort

ChannelChannel

ServiceService

QueueQueue

PubSubPubSub

RouterRouter

System.TimersSystem.Timers

System.GlobalizationSystem.Globalization

System.SerializationSystem.Serialization

System.ThreadingSystem.Threading

System.TextSystem.Text

System.DesignSystem.Design

Base & Application Services

Fundamentals

System.ComponentModelSystem.ComponentModel

System.CodeDomSystem.CodeDom

System.ReflectionSystem.Reflection

System.EnterpriseServicesSystem.EnterpriseServices

System.TransactionsSystem.Transactions

Security

System.Windows.TrustManagementSystem.Windows.TrustManagement

System.Web.SecuritySystem.Web.Security

System.MessageBus.SecuritySystem.MessageBus.Security

AuthorizationAuthorization

AccessControlAccessControl

CredentialsCredentials

CryptographyCryptography

System.Web.ConfigurationSystem.Web.Configuration

System.MessageBus.ConfigurationSystem.MessageBus.Configuration

System.ConfigurationSystem.Configuration

System.ResourcesSystem.ResourcesSystem.ManagementSystem.Management

System.DeploymentSystem.Deployment

System.DiagnosticsSystem.Diagnostics

Configuration Deployment/Management

System.WindowsSystem.Windows System.WindowsSystem.WindowsSystem.Windows.FormsSystem.Windows.Forms

System.ConsoleSystem.Console

System.ServiceProcessSystem.ServiceProcess

System.Windows.FormsSystem.Windows.Forms System.WebSystem.Web System.StorageSystem.Storage System.Data.SqlServ

erSystem.Data.SqlServer

AnimationAnimation

ControlsControls

ControlControl

DesignDesign

PanelPanel

ControlsControls

DialogsDialogs

SideBarSideBar

NotificationNotification

System.WindowsSystem.Windows

DocumentsDocuments

Text ElementText Element

ShapesShapes

ShapeShape

InkInk

UI ElementUI Element ExplorerExplorer MediaMedia

System.Windows.FormsSystem.Windows.Forms

FormsForms

ControlControl

Print DialogPrint Dialog

DesignDesign

System.Web.UISystem.Web.UI

PagePage

ControlControl

HtmlControlsHtmlControls

MobileControlsMobileControls

WebControlsWebControls

AdaptorsAdaptors

DesignDesign

PortsPorts

InteropServicesInteropServices

System.RuntimeSystem.Runtime

System.IOSystem.IO

System.CollectionsSystem.Collections

GenericGeneric

System.SearchSystem.Search

AnnotationsAnnotations

MonitoringMonitoring

LoggingLogging

RelevanceRelevance

System.DataSystem.Data

SqlClientSqlClient

SqlTypesSqlTypes

SqlXMLSqlXML

OdbcClientOdbcClient

OleDbClientOleDbClient

OracleClientOracleClient

CoreCore

ContactContact

LocationLocation

MessageMessage

DocumentDocument

EventEvent

System.StorageSystem.Storage

System.WebSystem.Web

PersonalizationPersonalization

CachingCaching

SessionStateSessionState

System.XmlSystem.Xml

SchemaSchema

SerializationSerialization

XpathXpath

QueryQuery

PermissionsPermissions

PolicyPolicy

PrincipalPrincipal

TokenToken

System.SecuritySystem.Security

System.CollaborationSystem.Collaboration

RealTimeEndpointRealTimeEndpoint

TransientDataSessionTransientDataSession

SignalingSessionSignalingSession

MediaMedia

ActivitiesActivities

HttpWebRequestHttpWebRequest

FtpWebListenerFtpWebListener

SslClientStreamSslClientStream

WebClientWebClient

System.NetSystem.Net

NetworkInformationNetworkInformation

SocketsSockets

CacheCache

System.WebSystem.Web

AdministrationAdministration

ManagementManagement

NavigationNavigation

Peer GroupPeer Group

PolicyPolicy

SerializationSerialization

CompilerServicesCompilerServices

RecognitionRecognition

System.SpeechSystem.Speech

SynthesisSynthesis

SerializationSerialization

SerializationSerialization

3

AgendaAgenda

OverviewWhat’s new in “Whidbey”What’s new in “Indigo”Moving to “Indigo”What’s in the PDC bitsWrap UpDiscussion

OverviewWhat’s new in “Whidbey”What’s new in “Indigo”Moving to “Indigo”What’s in the PDC bitsWrap UpDiscussion

4

Serialization OverviewSerialization Overview

The transformation of a graph of objects to a stream and back again

System.Xml.SerializationSystem.Runtime.Serialization

The transformation of a CLR type into an another type system (XSD) and back again

System.Xml.Serialization

Framework-wide featureWeb Services, Remoting, Yukon, etc.End-user feature

The transformation of a graph of objects to a stream and back again

System.Xml.SerializationSystem.Runtime.Serialization

The transformation of a CLR type into an another type system (XSD) and back again

System.Xml.Serialization

Framework-wide featureWeb Services, Remoting, Yukon, etc.End-user feature

5

Serialization In “Whidbey”Serialization In “Whidbey”

6

What’s New For WhidbeyWhat’s New For Whidbey

XmlSerializerNew imperative modelSchema import extensibilitySerializer pregenerationGenerics supportSqlTypes

BinaryFormatterVersion tolerant serializationPerformance improvementsGenerics support

XmlSerializerNew imperative modelSchema import extensibilitySerializer pregenerationGenerics supportSqlTypes

BinaryFormatterVersion tolerant serializationPerformance improvementsGenerics support

7

Version Tolerant Serialization

System.Runtime.Serialization

8

Serialization In “Indigo”Serialization In “Indigo”

9

Base Operating System Services CLR

Transactions Storage

Protocols

Network Services

Kernel M

ode

Base Class LibrariesBase Class Libraries

Memory ManagerMemory Manager

Hosting LayerHosting Layer

Code ExecutionCode Execution LoaderLoader SecuritySecurity SerializationSerialization

LightweightTransactionsLightweightTransactions

TransactionCoordinatorTransactionCoordinator

KernelTransactionManager

KernelTransactionManager

LoggingServiceLoggingService

KernelKernel

Hardware Abstraction LayerHardware Abstraction Layer

ProcessManagerProcessManager

SecurityReference Monitor

SecurityReference Monitor

LPCFacilityLPCFacility

MemoryManagerMemoryManager

PowerManagerPowerManager

ConfigManagerConfigManager

Plug andPlayPlug andPlay

TransactedNTFSTransactedNTFS

Cache ManagerCache

ManagerUniversalData Format

UniversalData Format

FilterEngineFilterEngine

TPC, UDPIPV4, IPV6TPC, UDPIPV4, IPV6 IPSECIPSEC QOSQOS HTTP

ListenerHTTPListener

Internet Connection FirewallInternet Connection Firewall

Demand Activation and Protocol HealthDemand Activation and Protocol Health

PNRPPNRP NativeWiFiNativeWiFi SIPSIP TCP

ListenerTCP Listener

UDP ListenerUDP Listener

IPC ListenerIPC Listener

Network Class LibraryNetwork Class Library

GDI/GDI+GDI/GDI+ WindowManagerWindowManager

GlobalAudio Engine

GlobalAudio Engine

DirectXGraphicsDirectXGraphics

Graphics driversGraphics drivers

DDIDDI InputManagerInputManager

AudioDriversAudioDrivers

DirectX GraphicsMini port

DirectX GraphicsMini port

RedirectorsRedirectors

SCSI/FCSCSI/FC 802.3802.3 802.11802.11 ....

Device Drivers

ManagementManagement

Presentation Data Communication

WinFS Indigo

Make the connection

Windows FormsAvalon ASP.NET

ObjectSpacesObjectSpaces

DataSetDataSet

SQL XMLSQL XML

ProvidersProviders

Fram

ework

Services Schemas

Data Model

ADO.NET

Connectivity

Synchronization(WinFS, Win32..)Synchronization(WinFS, Win32..)

InfoAgent(PreferenceRules..)InfoAgent(PreferenceRules..)

FileSystem Services(MetaDataHandlers..)FileSystem Services(MetaDataHandlers..)

CalendarCalendar MediaMedia

DocumentDocument ……

ItemsItems

RelationshipsRelationships

ExtensionsExtensionsCommunications Manager (Port)Communications Manager (Port)

Messaging Services

Transport Channels(IPC, HTTP, TCP…)Transport Channels(IPC, HTTP, TCP…)

IO ManagerIO Manager

Channels (Datagram, Reliable, Peer, …)

Channels (Datagram, Reliable, Peer, …)

Policy EnginePolicy Engine

MessageEncoderMessageEncoder

ChannelSecurityChannelSecurity

QueuingQueuing

EventingEventing

RoutingRouting

TransactionTransaction

Desktop ServicesDesktop Services

Desktop WindowManagerDesktop WindowManager

Presentation Object ManagerPresentation Object Manager

Desktop Composition EngineDesktop Composition Engine

Animation andCompositionAnimation andComposition

Media Services

Hardware RenderingHardware Rendering

MediaProcessingMediaProcessing

Capture and SourcingCapture and Sourcing

Software Renderingand SinksSoftware Renderingand Sinks

Adaptive UIEngineAdaptive UIEngine

Page/SiteCompositionPage/SiteComposition

Personalization andProfiling ServicesPersonalization andProfiling Services

Membership and Security ServicesMembership and Security Services

Designer ServicesDesigner Services

Controls Interop EngineControls Interop Engine

ControlsControls

Windows Forms

ApplicationServicesApplicationServices

Application DeploymentEngine (Click-Once)

Application DeploymentEngine (Click-Once)

PeoplePeople GroupGroup

Identity &SecuritySystem

Identity &SecuritySystem

Collaboration

People andGroupsPeople andGroups

CollaborationHistoryCollaborationHistory

Real-TimeActivitiesReal-TimeActivities

SignalingSignalingFederationFederation

System Services

FAT 16/32FAT 16/32

FilterManagerFilterManager

DistributedFile SystemDistributedFile System

Backup /RestoreBackup /Restore

File ReplicationServiceFile ReplicationService

Virtual DiskServiceVirtual DiskService

Models

ServiceServiceObjectObject T/SQLT/SQL XMLXMLDocumentDocument UIUI MediaMedia

10

Connector

Communications Manager (Port)Communications Manager (Port)

Transport Channels(IPC, HTTP, TCP…)Transport Channels(IPC, HTTP, TCP…)

Channels (Datagram, Reliable, Peer, …)Channels (Datagram, Reliable, Peer, …)

Policy EnginePolicy Engine

MessageEncoderMessageEncoder

ChannelSecurityChannelSecurity

Service Model

Hosting Environments

Instance ManagerInstance Manager

Context ManagerContext Manager

TypeIntegrationTypeIntegration

ServiceMethodsServiceMethods

DeclarativeBehaviorsDeclarativeBehaviors

TransactedMethodsTransactedMethods

ASP.NETASP.NET .container.container .exe.exe NT ServiceNT Service DllHostDllHost

Messaging Services

System Services

QueuingQueuing

RoutingRouting

EventingEventing

……

Transaction Transaction

Federation Federation

……

“Indigo” Architecture“Indigo” Architecture

11

A Tale Of Two Type SystemsAct One (“Whidbey”)

A Tale Of Two Type SystemsAct One (“Whidbey”)

CLRCLRXSDXSDChallengingChallenging

CLRCLR XSDXSDStraight ForwardStraight Forward

CLRCLR CLRCLRReally easyReally easy

XmlSerializerProvides CLR programming model for some XSD constructsMaps some CLR types into XSD

SoapFormatterMaps some CLR types (simple types) into XSDCustom SOAP encoding for the rest

BinaryFormatterNo support for XSDCLR CLR only

XmlSerializerProvides CLR programming model for some XSD constructsMaps some CLR types into XSD

SoapFormatterMaps some CLR types (simple types) into XSDCustom SOAP encoding for the rest

BinaryFormatterNo support for XSDCLR CLR only

Serialization

12

A Tale Of Two Type SystemsAct Two (“Indigo”)

A Tale Of Two Type SystemsAct Two (“Indigo”)

CLRCLRXSDXSDChallengingChallenging

CLRCLR XSDXSDStraight ForwardStraight Forward

CLRCLR CLRCLRReally EasyReally Easy

There are really two areas

Xml ProgrammingSerialization

Xml Programming is about, well, Xml

XmlSerializerXPathNavigator…

Serialization is about making CLR types

Interoperable (XSD) Loosely coupled

Enter the XmlFormatter...

There are really two areas

Xml ProgrammingSerialization

Xml Programming is about, well, Xml

XmlSerializerXPathNavigator…

Serialization is about making CLR types

Interoperable (XSD) Loosely coupled

Enter the XmlFormatter...

XML Programming

Serialization

13

XmlFormatter ArchitectureXmlFormatter Architecture

Serializable Types

Data Contract

[Serializable]

Representations

text/xml binary/xml

Serialization EngineXmlFormatter

SerializationContext

Xml ProcessingXmlReader

XmlWriter

ISerializable

ExtensibilitySurrogates

Type Binders

14

Serializable TypesSerializable Types

Existing Types[Serializable] & ISerializable types just workGain loose coupling & version resilient

Data ContractNew explicit programming modelEnables loose coupling for CLR typesVersion resilient by defaultFoundation for the future

Working TogetherInheritance and composition just work

Existing Types[Serializable] & ISerializable types just workGain loose coupling & version resilient

Data ContractNew explicit programming modelEnables loose coupling for CLR typesVersion resilient by defaultFoundation for the future

Working TogetherInheritance and composition just work

15

XmlFormatter And Serializable Types

System.Runtime.Serialization

16

“Indigo” XSD Support“Indigo” XSD Support

Every serializable type is interoperable

We export valid XSD for any CLR constructOur mapping is not extensible (POR for v1)

Every XSD schema is supportedXmlFormatter

We provide a canonical CLR XSD mappingNo mapping extensibility (POR for v1)

XML programming models Supports all schema constructsXmlSerializer, XPathNavigator, …

Every serializable type is interoperable

We export valid XSD for any CLR constructOur mapping is not extensible (POR for v1)

Every XSD schema is supportedXmlFormatter

We provide a canonical CLR XSD mappingNo mapping extensibility (POR for v1)

XML programming models Supports all schema constructsXmlSerializer, XPathNavigator, …

17

XSD Support

System.Runtime.Serialization

18

Moving To “Indigo”Moving To “Indigo”

“Indigo” works well with COM+, MSMQ, WSE, and ASMX apps“Indigo” nodes are easy to integrate into existing systemsExisting applications have an easy migration path to “Indigo”

Existing serializable types and serialization extensibility points just work

Follow the prescriptive guidance for writing distributed applications

Read and follow the serializable type guidelines

“Indigo” works well with COM+, MSMQ, WSE, and ASMX apps“Indigo” nodes are easy to integrate into existing systemsExisting applications have an easy migration path to “Indigo”

Existing serializable types and serialization extensibility points just work

Follow the prescriptive guidance for writing distributed applications

Read and follow the serializable type guidelines

19

About The PDC BitsAbout The PDC Bits

Two “Whidbey” features are availableIXmlSerializable SqlTypesThe rest are being coded as we speak

System.SerializationSuccessor to the XmlSerializerYet another XML programming modelTaught us invaluable lessonsWill likely not ship with “Indigo”

Two “Whidbey” features are availableIXmlSerializable SqlTypesThe rest are being coded as we speak

System.SerializationSuccessor to the XmlSerializerYet another XML programming modelTaught us invaluable lessonsWill likely not ship with “Indigo”

20

For More InformationFor More Information

AnytimeE-Mail: [email protected]: http://www.douglasp.comLHDC: http://msdn.microsoft.com/longhornNS: microsoft.public.windows.developer.winfx.indigo

At PDCHands on labs: On-site or download from CommNetWeb/Services Lounge: 309 FoyerAsk The Experts: Tuesday 7 P.M. – 9 P.M. Hall G, HPDC Weblogs: http://pdcbloggers.net

AnytimeE-Mail: [email protected]: http://www.douglasp.comLHDC: http://msdn.microsoft.com/longhornNS: microsoft.public.windows.developer.winfx.indigo

At PDCHands on labs: On-site or download from CommNetWeb/Services Lounge: 309 FoyerAsk The Experts: Tuesday 7 P.M. – 9 P.M. Hall G, HPDC Weblogs: http://pdcbloggers.net

21

This Talk In A NutshellThis Talk In A Nutshell

“Whidbey” offers a number evolutionary features to current serialization stacks“Indigo” delivers a unified serialization engine

InteroperableBackward compatibility Version resilientHigh performance

“Indigo” supports many XML programming modelsWe need your feedback!!!

“Whidbey” offers a number evolutionary features to current serialization stacks“Indigo” delivers a unified serialization engine

InteroperableBackward compatibility Version resilientHigh performance

“Indigo” supports many XML programming modelsWe need your feedback!!!

22© 2003-2004 Microsoft Corporation. All rights reserved.This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.