What’s in.NET 3.5 for Services? The New HTTP Programming Model New Support for JSON Services Syndication in.NET 3.5.

Slides:



Advertisements
Similar presentations
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Advertisements

Background REST (Representational State Transfer) What does it mean to be RESTful? Why REST? WCF How does WCF support REST? What are the pieces we need.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
Windows 8 (1) (2) (3) Windows 8 (1) (2) (3)
Feature: Identity Management - Login © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
© 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Feature: Reprint Outstanding Transactions Report © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product.
Feature: Purchase Requisitions - Requester © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
MIX 09 4/15/ :14 PM © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
ASP.NET 3.5 Mike Ormond Developer & Platform Group Microsoft Ltd
.NET Framework V3.5+ & RESTful web services Mike Taulty Developer & Platform Group Microsoft Ltd
 Stephen Walther ASP.NET MVC Ninja Microsoft Corporation PV31.
What’s new in ASP.NET 3.5? Mike Ormond Developer & Platform Group Microsoft Ltd
Co- location Mass Market Managed Hosting ISV Hosting.
Jon Flanders INT303. About Me  Jon Flanders –  Independent consultant/trainer  BizTalk MVP.
Windows 7 Training Microsoft Confidential. Windows ® 7 Compatibility Version Checking.
Multitenant Model Request/Response General Model.
Feature: Purchase Order Prepayments II © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are.
Feature: OLE Notes Migration Utility
Feature: Web Client Keyboard Shortcuts © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are.
Feature: SmartList Usability Enhancements © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
Session 1.
Built by Developers for Developers…. © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
 Rico Mariani Architect Microsoft Corporation.
 Bertrand Le Roy Senior Program Manager Lead Microsoft Corporation PC32.
Feature: Assign an Item to Multiple Sites © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
Feature: Print Remaining Documents © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or.
Project “Astoria” first announced in Mix 2007 Shared early prototypes, got tons of feedback Now we’re talking about the real deal Production quality bits,
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.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
Feature: Document Attachment –Replace OLE Notes © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product.
 Mike Flasko Program Manager Microsoft Corporation TL07.
Microsoft TechDays Сергей Звездин
Feature: Suggested Item Enhancements – Sales Script and Additional Information © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows.
Feature: Customer Combiner and Modifier © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are.
Feature: Employee Self Service Timecard Entry © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
Web Service Programming with WCF 3.5 Eyal Vardi CEO E4D Solutions LTD Microsoft MVP Visual C# blog:
SQL Server SQL Azure Visual Studio“Quadrant” SQL Server Modeling Services Entity Framework ADO.NET“M”/EDM Data Services …
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or.
demo Instance AInstance B Read “7” Write “8”

customer.
1 ADO.NET Data Services Mike Taulty Developer & Platform Group Microsoft Ltd
demo © 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
06 | HTTP Services with Web API Bruno Terkaly | Technical Evangelist Bret Stateham | Technical Evangelist.
demo Demo.
Feature: Void Historical/Open Transaction Updates © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product.
demo QueryForeign KeyInstance /sm:body()/x:Order/x:Delivery/y:TrackingId1Z
Feature: Suggested Item Enhancements – Analysis and Assignment © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and.
projekt202 © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are.
The CLR CoreCLRCoreCLR © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product.
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks.
© 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or.

Implementing RESTful Services Using the Microsoft .NET Framework
Driving Experiences via Services Using the Microsoft .NET Framework
Office Mac /30/2018 © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Title of Presentation 12/2/2018 3:48 PM
MIX 09 12/9/2018 6:08 PM © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
The OpenRasta framework for building RESTful applications
Maxim Lukiyanov Program Manager Microsoft Corporation
Silverlight Debugging
8/04/2019 9:13 PM © 2006 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Виктор Хаджийски Катедра “Металургия на желязото и металолеене”
Шитманов Дархан Қаражанұлы Тарих пәнінің
Title of Presentation 5/24/2019 1:26 PM
Presentation transcript:

What’s in.NET 3.5 for Services? The New HTTP Programming Model New Support for JSON Services Syndication in.NET 3.5

Lots of ways to create services Crescendo of features through the stack HttpListener ASP.NET ASMX WCF Sockets

One-stop-shop for services Consistent object model Great “ility” features 1 st released with.NET Framework 3.0 Focus on the functionality, WCF takes care of the plumbing

Myth: WCF is only for enterprise services Reality: WCF gets around(enterprise & web).NET 3.5 WCF web-centric upgrades: Make REST a 1 st class citizen Embrace SOAP-less representations JSON messaging capabilities Simplify working with POX RSS & Atom syndication support Run in Partial Trust (Hosting)

Promote web concepts to 1 st class citizens Simplify the following: mapping URIs to application logic working with HTTP methods working with Response Codes & HTTP Headers Allow SOAP & POX from the same contract Possible to do SOAP/RPC & REST from the same application

System.UriTemplate Type for modeling URI to application semantics Can “bind” data to a template, output a URI Can “match” a URI to a template, retrieve data System.UriTemplateMatch Returned from UriTemplate “match” operations Can get relative paths and wildcard segments System.UriTemplateTable For “binding” a URI to a group of UriTemplates

// create the base Uri Uri address = new Uri(“ // create the template for a URI UriTemplate template = new UriTemplate(“{artist}/{album}”); // set the values of the URI segments Uri boundUri = template.BindByPosition(address, “Northwind”, “Overdone”); // Console.WriteLine(address.ToString()); // create the base Uri Uri address = new Uri(“ // create the template for a URI UriTemplate template = new UriTemplate(“{artist}/{album}”); // set the values of the URI segments Uri boundUri = template.BindByPosition(address, “Northwind”, “Overdone”); // Console.WriteLine(address.ToString());

// address & boundUri from previous slide // use the template to parse boundUri UriTemplateMatch match = template.Match(address, boundUri); String bandName = match.BoundVariables[“artist”]; // writes “Artist name: Northwind” Console.WriteLine(“Artist name: {0}”, bandName); // address & boundUri from previous slide // use the template to parse boundUri UriTemplateMatch match = template.Match(address, boundUri); String bandName = match.BoundVariables[“artist”]; // writes “Artist name: Northwind” Console.WriteLine(“Artist name: {0}”, bandName);

Simple URI-to-application mapping Defaults to query string parameters [OperationContract] [WebGet(UriTemplate=“/Image/{artist}/{album}”)] Stream GetAlbumImage(String artist, String album); [OperationContract] [WebGet(UriTemplate=“/Image?name={artist})] Stream GetMainImage(String artist); [OperationContract] [WebGet(UriTemplate=“/Image/{artist}/{album}”)] Stream GetAlbumImage(String artist, String album); [OperationContract] [WebGet(UriTemplate=“/Image?name={artist})] Stream GetMainImage(String artist);

All HTTP verbs are 1 st class citizens GET, POST, PUT, DELETE, GET, POST, PUT, DELETE, “View It” vs “Do It” separation mimics web [OperationContract] [WebGet(UriTemplate=“/Image/{bandName}/{album}”)] Stream GetAlbumImage(String bandName, String album); [OperationContract] [WebInvoke(METHOD=“PUT”)] // {PUT, POST, DELETE} void AddAlbum(AlbumInfo albumInfo); // entity body [OperationContract] [WebGet(UriTemplate=“/Image/{bandName}/{album}”)] Stream GetAlbumImage(String bandName, String album); [OperationContract] [WebInvoke(METHOD=“PUT”)] // {PUT, POST, DELETE} void AddAlbum(AlbumInfo albumInfo); // entity body

WebOperationContext.Current provides access to incoming request headers Can also set outgoing response headers Some are shortcut for easier use Stream GetAlbumImage(String bandName, String album){ Stream stream; // get the image from somewhere WebOperationContext.Current.OutgoingResponse.ContentType = “image/jpeg”; return stream; } Stream GetAlbumImage(String bandName, String album){ Stream stream; // get the image from somewhere WebOperationContext.Current.OutgoingResponse.ContentType = “image/jpeg”; return stream; }

WebHttpBinding and WebServiceHost Use WebServiceHost/Factory in most cases Big Win – no config/behavior needed WebHttpBinding endpoint on a ServiceHost Add WebHttpBehavior to the endpoint Big Win – Compatible with existing WCF hosts Works in ASP.NET Medium Trust!

JavaScript Object Notation Convenient bridge: JavaScript  objects Easier for browsers than XML ASP.NET AJAX & other AJAX toolkits use it Other web-aware clients also (Silverlight, etc.) var someData = {"album":"Overdone", "artist":"Northwind"}; var writeToElement = document.getElementById("RawJSON"); writeToElement.innerHTML = someData.artist + ", " + someData.album; var someData = {"album":"Overdone", "artist":"Northwind"}; var writeToElement = document.getElementById("RawJSON"); writeToElement.innerHTML = someData.artist + ", " + someData.album;

It’s all built on.NET 3.0 extensibility points Uses the same DataContract annotation JsonReaderWriterFactory Creates XmlDictionaryReader / Writer objects DataContractJsonSerializer Bridges objects & JSON [DataContract] public class SomeClass { [DataMember] public String SomeValue { get; set; } } [DataContract] public class SomeClass { [DataMember] public String SomeValue { get; set; } }

Can be simple JSON messaging Set RequestFormat / ResponseFormat Add WebHttpBehavior to endpoint Integrates with ASP.NET AJAX Add WebScriptEnablingBehavior to endpoint OR Use WebScriptServiceHost / Factory for automatic endpoint creation (0 config)

Full support in the client stack WCF AJAX support in Visual Studio Script manager, VS Project Templates IntelliSense for JavaScript works with JS proxies (both ASMX and WCF) Config not required Via the WebScriptServiceHostFactory (.svc file) Works in ASP.NET Medium Trust!

Syndications are more than news and blogs Unified object model for RSS and Atom SyndicationFeed / SyndicationItem Can be used with or without the rest of WCF Supports syndication extensions Format Agnostic RSS 2.0 & ATOM 1.0, others possible Works in ASP.NET Medium Trust!

[ServiceKnownType(typeof(Atom10FeedFormatter))] [ServiceKnownType(typeof(Rss20FeedFormatter))] [ServiceContract] interface IAlbumSyndication { [OperationContract] [WebGet(UriTemplate=“Images/{format}")] SyndicationFeedFormatter Feed(String format); } [ServiceKnownType(typeof(Atom10FeedFormatter))] [ServiceKnownType(typeof(Rss20FeedFormatter))] [ServiceContract] interface IAlbumSyndication { [OperationContract] [WebGet(UriTemplate=“Images/{format}")] SyndicationFeedFormatter Feed(String format); } Can decide format from URI

© 2008 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.