Visual Studio 2008 and Service Oriented...
Transcript of Visual Studio 2008 and Service Oriented...
Dave GloverDeveloper EvangelistMicrosoft Australia Pty LtdBlog: http://blogs.msdn.com/dglover
{Visual Studio 2008 and Service Oriented Development}
Windows Communication Foundation
Review
New support in .NET Framework 3.5 for
RESTful ServicesRepresentational State Transfer
Syndication
Visual Studio 2008 and .NET 3.5
provide seamless support for all
of the protocols and techniques
popular in Web 2.0-style
applications.
Visual Studio 2008 provides visual
designers, debugging and profiling
for WCF and WF.
Numerous project items for service
oriented architectures.
Services are often used to implement pattern-based behavior
and/or business rules.
Visual Studio 2008 provides integration between Windows
Workflow and Windows Communication Server.
SOAP/WS-* and REST
Two approaches to Web services are in use today:SOAP and the WS-* specifications
More Enterprise/Business Process Focused
Representational State Transfer (REST)Amazon S3, Flickr, Facebook, Twitter
Plenty of debate between proponents of each approach
.NET Fx 3.5 and Windows Communication Foundation (WCF) support for both approaches
Microsoft is agnostic in this debate
Interopwith otherplatforms
ASMX
Attribute-Based
Programming
Enterprise
Services
WS-*ProtocolSupport
WSE
Message-Oriented
Programming
System.Messaging
ExtensibilityLocation
transparency
.NET
Remoting
Building your first WCF Project inVisual Studio 2008
WCF Test Harness
Illustrating the approach
POST /AccountAccess/Accounts.svc
Host: www.quickbank.com
SOAPAction: GetBalance
…
<soap:Envelope xmlns:soap= …
<soap:Body>
<GetBalance xmlns= …
<Account>2</Account>
</GetBalance>
</soap:Body>
</soap:Envelope>
WCF
Client
WCF
Service
Account 1
Account 2
Account 3
An architectural style
Two core principles:
Everything accessed through a uniform interface
All data is identified with a URI
Principles for scalability on the Web
Be stateless
Be cacheable whenever possible
RESTful Web ServicesBy Leonard Richardson and Sam Ruby
A closer look
Primarily POST, GET, PUT, and DELETE (≈ CRUD)
The semantics of GET are well-defined
The semantics of the others are more ambiguousAn example from the HTTP 1.1 spec:
POST is designed to allow a uniform method to cover the
following functions:
- Annotation of existing resources;
- Posting a message to a bulletin board, newsgroup,
mailing list, or similar group of articles;
- Providing a block of data, such as the result of
submitting a form, to a data-handling process;
- Extending a database through an append operation.
The actual function performed by the POST method is
determined by the server . . .
Illustrating the approach
WCF
Client
WCF
Service
GET www.quickbank.com/Accounts/2
Account 1
Account 2
Account 3
WCF interface
[ServiceContract]
interface IAccount
{
[OperationContract]
[WebGet]
int GetBalance(string account);
[OperationContract]
[WebInvoke]
int UpdateBalance(string account,
int amount);
}
Sends request using HTTP
GET
Sends request using
HTTP POST (by default)
Session List REST Demo..\Services\RESTSessionSL\RESTSessionSL.sln
A service for banking functions might include discrete operations such as:
GetBalance(Account)
UpdateBalance(Account, Amount)
GetPhoto(PhotoId)
These work well with either REST or SOAP
Suppose you needed to
Transfer Money or Book Travel
Co-ordinated Processes across multiple services Banks, Airlines, hotels, cars etcFits the process-oriented, broker distributed SOAP services
Protocol for invoking operations SOAP HTTP
Transport protocol HTTP, TCP, others HTTP
Language for describing
interfaces
WSDL No standard
Conveying security tokens WS-Security HTTP, SSL
Acquiring security tokens WS-Trust No standard
Establishing a security context WS-SecureConversation SSL
Providing end-to-end reliability WS-ReliableMessaging No standard
Supporting distributed ACID
transactions
WS-AtomicTransaction,
WS-Coordination
No standard
Defining policy WS-Policy, et al. No standard
Acquiring interface definitions WS-MetadataExchange No standard
A capability summary
SOAP/WS-* REST
What is exposed?
REST Focused on accessing named data
The barrier to entry is lowRelies on HTTP and URLs no special libraries
Eg JavaScript, Python, Ruby
KISS Focus is simplicity
SOAP Focused on accessing named operations, each of which implements some logic
The barrier to entry is higherSOAP requires a SOAP stack, WSDL, and maybe implementations of the WS-* specs
Richer Application Services
Broad Standardisation
Syndication is very popular and an ideal way to spread the use of your applications.
WCF Syndication Services
Visual Studio 2008 provides a project template that
creates a syndication based WCF project. This project
type enables you to immediately expose a RSS or
ATOM based feed.
Session List Syndication..\Services\WCF REST, JSON & Syndication\RESTSyndication.sln
Visual Studio 2008 and .NET 3.5
provide seamless support for all
of the protocols and techniques
popular in Web 2.0-style
applications.
Visual Studio 2008 provides visual
designers, debugging and profiling
for WCF and WF.
Numerous project items for service
oriented architectures.
Services are often used to implement pattern-based behavior
and/or business rules.
Visual Studio 2008 provides integration between Windows
Workflow and Windows Communication Server.
Install Visual Studio 2008
Download available for MSDN Subscribers
Download Starter kits, hands-on-labs and videos
http://download.vstudio/starterkits
Become familiar with WCF and WF
http://wcf.netfx3.com/
http://wf.netfx3.com/
User Group Communities Across Australia
http://msdn2.microsoft.com/en-au/cc185136.aspx
© 2007 Microsoft Corporation. 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.