session 1: the soap story
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=316TRANSCRIPT
The SOAP Story
Martin ParryDeveloper & Platform GroupMicrosoft [email protected] http://martinparry.com
Agenda
DefinitionsSOAP through the agesSOAP and “standards”Approaches to building and using servicesSOAP Services with WCFServices and the Workflow Foundation
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
SOAP on the Microsoft Platform
SOAP ToolkitNT4, Windows 2000IIS4 or IIS5Based around COMUsed ISAPI filterNo longer in mainstream supportExtended support expires in March 2008
SOAP on the Microsoft Platform
SOAP ToolkitNT4, Windows 2000IIS4 or IIS5Based around COMUsed ISAPI filterNo longer in mainstream supportExtended support expires in March 2008
SOAP on the Microsoft Platform
SOAP MonikerIntroduced in Windows XP ProfessionalScriptable mechanism for invoking web servicesExample vbscript...
Dim proxySet proxy = GetObject(“soap:wsdl=http://....”)
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
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
SOAP on the Microsoft Platform
Web Services EnhancementsNow in v3.0Adds support for some WS-* protocolsAllows non-IIS servicesAllows non-HTTP transport
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
“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
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
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
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”
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
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
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?
Mechanics of Communication
“Service”“Client”
EndpointContractBindingAddress
EndpointContractBindingAddress
EndpointContractBindingAddress
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)
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
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
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
Windows Communication Foundation
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
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
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
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
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
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
Security in WCF - Extensibility
Roll your ownUsername validatorToken validatorCredential typesSecurity Token ServiceSAML claimsEtc...
Federated Security with WCF
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
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
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
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
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
Services with WF
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
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
MSDN in the UK
Visit http://msdn.co.uk NewsletterEventsScreencastsBlogs
© 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.