session 1: the soap story

41
The SOAP Story Martin Parry Developer & Platform Group Microsoft Ltd [email protected] http://martinparry.com

Upload: ukdpe

Post on 18-Nov-2014

3.324 views

Category:

Technology


1 download

DESCRIPTION

Building Services: .NET FX 3.5, SOAP, REST, and Beyond Most developers will be aware of various Microsoft technologies to help build SOAP services, the latest of which are WCF and WF in .NET FX 3.5, but there’s another world of services outside SOAP. Recently Microsoft has been very active in its support for, and use of, REST as a mechanism for implementing services. This event will cover recent and forthcoming technologies for building services with SOAP and REST, and we’ll explain REST for the uninitiated. Agenda: Session 1: The SOAP Story In this session we’ll do a lighting quick re-cap of what SOAP is, what specs surround it before looking at how far the SOAP programming model has come in Microsoft’s latest-and-greatest stack – Windows Communication Foundation (WCF) V3.5. We’ll talk about different approaches to building services and we’ll take a good look at the integration between WCF V3.5 and Windows Workflow Foundation (WF) V3.5 which opens up a whole new way of implementing services. Session 2: Time for a REST Web applications have evolved; using technologies like AJAX and Silverlight they have rich client-side code that wants to consume services, but they prefer JSON, “plain xml” and REST. In this session we’ll introduce REST for the uninitiated, and we’ll demonstrate some of the new and forthcoming technology that Microsoft has for working with REST: WCF 3.5, Web3S, Windows Live Data, and Codename “Astoria”. For more details and the original slidedeck visit http://www.microsoft.com/uk/msdn/events/new/Detail.aspx?id=316

TRANSCRIPT

Page 1: Session 1: The SOAP Story

The SOAP Story

Martin ParryDeveloper & Platform GroupMicrosoft [email protected] http://martinparry.com

Page 2: Session 1: The SOAP Story

Agenda

DefinitionsSOAP through the agesSOAP and “standards”Approaches to building and using servicesSOAP Services with WCFServices and the Workflow Foundation

Page 3: Session 1: The SOAP Story

Definitions

SOAP Initially: Simple Object Access ProtocolIt’s about services that exchange messagesThe messages are formed from XMLEach message has headers plus a body

WSDLDescribes services and their operationsUses XML and schema to describe messages

Page 4: Session 1: The SOAP Story

SOAP on the Microsoft Platform

SOAP ToolkitNT4, Windows 2000IIS4 or IIS5Based around COMUsed ISAPI filterNo longer in mainstream supportExtended support expires in March 2008

Page 5: Session 1: The SOAP Story

SOAP on the Microsoft Platform

SOAP ToolkitNT4, Windows 2000IIS4 or IIS5Based around COMUsed ISAPI filterNo longer in mainstream supportExtended support expires in March 2008

Page 6: Session 1: The SOAP Story

SOAP on the Microsoft Platform

SOAP MonikerIntroduced in Windows XP ProfessionalScriptable mechanism for invoking web servicesExample vbscript...

Dim proxySet proxy = GetObject(“soap:wsdl=http://....”)

Page 7: Session 1: The SOAP Story

SOAP on the Microsoft Platform

.NET RemotingSupports TCP and HTTP transportsCan use IIS, or notSupports SOAP formatting, or binarySignificant difference: -

– Distributed Object programming paradigm– As opposed to message passing

Page 8: Session 1: The SOAP Story

SOAP on the Microsoft Platform

ASP.NET.asmx web services“add web reference”Still relies on IISSupport in v2.0 for WS-I Basic ProfileNo other “standards” support is built-in

Page 9: Session 1: The SOAP Story

SOAP on the Microsoft Platform

Web Services EnhancementsNow in v3.0Adds support for some WS-* protocolsAllows non-IIS servicesAllows non-HTTP transport

Page 10: Session 1: The SOAP Story

SOAP on the Microsoft Platform

Windows Communication FoundationIntroduced in .NET FX 3.0Entirely new communications APIAllows for changes in transports and protocolsVery extensibleCan use IIS, or notCan use HTTP, or not

– Ships with named pipes, TCP, MSMQ, P2P

Page 11: Session 1: The SOAP Story

“Standards”

WS-SecurityMessage-level security

WS-SecureConversationOptimisation for WS-Security

WS-PolicyContractual info not contained in WSDL

WS-SecurityPolicyPolicy rules that are specific to security

WS-TrustDefines STS

Page 12: Session 1: The SOAP Story

Approaches – Distributed Objects

A long history on the Microsoft platformDCOM, .NET Remoting

Difficulty in managing object lifetimesWisdom of making network transparent?

Perhaps the developer needs to know?

Simple, OO paradigm – easy to code against

Page 13: Session 1: The SOAP Story

Approaches – Message Exchange

Probably still use a proxy classHow is message body formed?

Serialized object graph, orApplication code emits XML content directly

SOAP is all about message exchange reallyJust a question of how this appears to the application developer

Different exchange patternsRequest/response, one-way, duplex, intermediaries

Page 14: Session 1: The SOAP Story

Approaches - SOA

There are multiple definitions of SOANot necessarily tied to web services

A service performs one standalone piece of the business process

Participates in message exchangeNo notion of data + behaviour, as in OOShould use contract + policy so that clients can be built correctlySometimes see “service brokers”

Page 15: Session 1: The SOAP Story

InteropInteropwith otherwith otherplatformsplatforms

ASMX

Attribute- Attribute- BasedBased

ProgrammingProgramming

Enterprise Services

WS-*WS-*ProtocolProtocolSupportSupport

WSE

Message-Message-OrientedOriented

ProgrammingProgramming

System.Messaging

ExtensibilityExtensibilityLocation transparencyLocation transparency

.NET Remoting

Page 16: Session 1: The SOAP Story

Distributed Applications

Services pass messages described by a contractService may provide metadata, describing: -

The contractThe policy applied to communication

“Client”Message

Message

“Service”

Metadata

Message (SOAP)

Headers: Addressing, Security, etc.

Body: Payload

Page 17: Session 1: The SOAP Story

What do I send?

Where do I send it?

How should I send it?

Contract

Address

Binding

Mechanics of Communication

“Service”“Client”

Transport?

Encoding?

Security?

Page 18: Session 1: The SOAP Story

Mechanics of Communication

“Service”“Client”

EndpointContractBindingAddress

EndpointContractBindingAddress

EndpointContractBindingAddress

Page 19: Session 1: The SOAP Story

Contracts[ServiceContract]

public interface INuggetAccess

{

[OperationContract] string[] GetTopics();

}

.NET Interface

<definitions>

<portType>

<operation name=“GetTopics”> …

</portType>

</definitions>

WSDL

svcutil.exe

“Service”“Client”

[ServiceContract]

public interface INuggetAccess

{

[OperationContract] string[] GetTopics();

}

public class NuggetAccessService :

INuggetAccess

{ string[] GetTopics() { }

}

Implements

Consumes

request metadata (WSDL)

Page 20: Session 1: The SOAP Story

Richness of metadata

Service can advertise a lot of info to a client

WSDLWS-Policy (security etc)

Can do so overHTTPWS- MetadataExchange

Makes building “clients” a lot simpler

Service

Contracts

Endpoints

Page 21: Session 1: The SOAP Story

Contract Details

Message exchange might be: -One-way, Request/Response, Two-way (Duplex)

WCF also supports serialization models from .NET 2.0System.Xml.XmlSerialization, System.Runtime.Serialization

[ServiceContract]

public interface INuggetAccess {

[OperationContract] List<TopicInfo> GetTopics();

}

Service

[DataContract(Namespace=…)]

public class TopicInfo {

[DataMember]

public int Id

}

Data

[MessageContract]

public class TypedMessage {

[MessageBody]

[MessageHeader]

}

Message

Page 22: Session 1: The SOAP Story

Hosting Servicespublic class Service :

INuggetAccess

{ string[] GetTopics() { }

}

IIS

<%@ ServiceHost Service=“Service" %>

NuggetAccessService.svc

MyApp.exe

ServiceHost host =

new ServiceHost();

host.Open();

References

ServiceHost is the key class for hostingNeeds manual steps in your host applicationAutomatically done by IIS when provided with a .svc file

IIS handles additional transports in v7.0

Page 23: Session 1: The SOAP Story

Windows Communication Foundation

Page 24: Session 1: The SOAP Story

Client

WCF – sketched architecture

Binding(ordered list of channel types & config)

channel type N

channel type 2

channel type 1config

config

config

Your code

Service

Your code

Met

adat

a

formatting

channel

channel

channel

Transport Channel (HTTP, TCP, MSMQ, Pipes, Peer)

channel

channel

channel

decodingencoding

behaviours behaviours

Page 25: Session 1: The SOAP Story

Standard Framework BindingsPre-built set in the framework

WS-I Basic ProfileWS-* on HTTPTCPNamed PipesMSMQPeer

Configure/code your own as a "custom" binding

Binding

Transactions

Reliability

Security

channels

Configuration

Configuration

Configuration

TransportConfiguration

Page 26: Session 1: The SOAP Story

Instancing, Concurrency, Sessions

Service classes can be instantiated: -Singleton, Per-Call, Per-Session, Shareable

Service code can be either: -Single threaded, Re-entrant or Multi-threaded

Client

Service

Singleton

Message B

Message C

Message A

Page 27: Session 1: The SOAP Story

Instancing, Concurrency, Sessions

Service classes can be instantiated: -Singleton, Per-Call, Per-Session, Shareable

Service code can be either: -Single threaded, Re-entrant or Multi-threaded

Client

Service

Single Call

Single Call

Single Call

Message B

Message C

Message A

Page 28: Session 1: The SOAP Story

Instancing, Concurrency, Sessions

Service classes can be instantiated: -Singleton, Per-Call, Per-Session, Shareable

Service code can be either: -Single threaded, Re-entrant or Multi-threaded

Client

Service

Per SessionMessage B

Message Asession

Per SessionMessage C

Page 29: Session 1: The SOAP Story

Security in WCF – Out of the box

Transport LevelHTTPSIIS authentication modes

Message LevelUserName, X.509 Certificate, WindowsIssuedToken – that is, federated security

ASP.NET membership and role providers

Page 30: Session 1: The SOAP Story

Security in WCF - Extensibility

Roll your ownUsername validatorToken validatorCredential typesSecurity Token ServiceSAML claimsEtc...

Page 31: Session 1: The SOAP Story

Federated Security with WCF

Page 32: Session 1: The SOAP Story

WCF in .NET FX 3.5

Most of the new stuff isn’t SOAPWe’ll see some of that in the next session

Client proxies and partial trust environmentsDurable servicesComing together with Workflow

Page 33: Session 1: The SOAP Story

Partial Trust

Now possible to call through WCF proxies in a partial trust environmentVarious caveats

Transport is HTTP only, Security is HTTPS onlyEncodings is all except MTOMBindings are BasicHttpBinding, WsHttpBinding, WebHttpBinding*Other limitations

– No Reliable Messaging, Transactions, Secure Conversation

Page 34: Session 1: The SOAP Story

Durable Services

Provider-based framework for easily adding long-running abilities to WCF services

client

Host (e.g. IIS)

implementation

stateresponse + token

initial call

serialize and store

statetoken

Page 35: Session 1: The SOAP Story

Durable Services

Provider-based framework for easily adding long-running abilities to WCF services

client

Host (e.g. IIS)

implementation

state

second call + token

load and deserialize

statetoken

Page 36: Session 1: The SOAP Story

Workflow

WF is not strictly about services, or SOAPIn .NET FX 3.5, WF has some WCF integrationA workflow can consume servicesWe can implement a service as a workflow

Page 37: Session 1: The SOAP Story

Services with WF

Page 38: Session 1: The SOAP Story

Summary

The Microsoft platform has evolved along with SOAP and its accompanying standardsCulminating in WCF

The most flexible, extensible communications stack we’ve ever produced

Page 39: Session 1: The SOAP Story

Additional InformationMSDN Developer Center for Web Services

http://msdn2.microsoft.com/en-gb/webservices/default.aspx

“Standards”http://www.w3.org http://www.ws-i.org http://www.oasis-open.org

SOAhttp://www.opengroup.org/projects/soa http://wiki.oasis-open.org/soa-rm

WCFhttp://netfx3.com/content/WCFHome.aspx

WFhttp://netfx3.com/content/WFHome.aspx

Page 40: Session 1: The SOAP Story

MSDN in the UK

Visit http://msdn.co.uk NewsletterEventsScreencastsBlogs

Page 41: Session 1: The SOAP Story

© 2007 Microsoft Ltd. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.

The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the

date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.