Download presentation
Presentation is loading. Please wait.
1
Adam Dille CS526 – Spring 2010
2
Advances in Microsoft’s service offerings ASMX vs. WCF Latest WCF Improvements (.NET 4.0) No in-depth study of backwards compatibility No comparisons to Java, Ruby, PHP, etc
3
ASMX Introduced with.NET 1.0 in 2002 Service creation is quick and painless Limited in scope WCF Introduced with.NET 3.0 in 2006 More steps involved to create and configure Much more broad in scope and abilities
4
Add ASMX file to Web Application Decorate a function with [WebMethod] attribute Viola! We have a web service! [WebMethod] public String SayHello(String name) { return “Hello “ + name; }
5
Limited to HTTP protocol Requires IIS, Cassini or hand-coded web server instance Relies on web server for security
6
Unifies development of web services, peer to peer, client/server and IPC Endpoints expose different protocols Combines and interoperates with: ASP.NET Web Services (ASMX) .NET Remoting Message Queuing Enterprise Services (COM+)
7
Variety of Security Options Windows Certificate Digest Basic UserName NTLM IssuedToken Allows varied security for same service through Endpoints
8
Attributes ServiceContract – Marks a class or interface as a WCF service OperationContract – Marks a function as a member of the parent service contract DataContract – Marks a class or struct as a data type that will be passed to or from the service DataMember – A property of a data contract that will be passed along with it’s parent object MessageContract – Allows explicit formatting of messages. Useful for interoperability.
9
[DataContract] public class HelloInfo { [DataMember] public String Name { get; set; } }
10
[ServiceContract] public interface IHelloService { [OperationContract] public String SayHello(HelloInfo info); } public class HelloService : IHelloService { public String SayHello(HelloInfo info) { return “Hello “ + info.Name; }
11
Hosting Options IIS 5 & 6 (HTTP protocol only) IIS 7 .NET Forms or Console application Windows Service
12
Defining Endpoint through Configuration
13
Defining Endpoint through Configuration public void DefineEndpointInConfig() { ServiceHost sh = new ServiceHost (typeof(HelloService)); sh.Open(); }
14
Defining Endpoint Imperatively public void DefineEndpointImperatively() { ServiceHost sh = new ServiceHost(typeof(HelloService)); sh.AddServiceEndpoint( typeof(IHelloService), new WSHttpBinding(), "http://localhost/HelloService/EP1"); sh.Open(); }
15
Released April 12, 2010 Simplified Configurations (Config-free!) Service discovery Routing services REST Improvements Workflow Services Integration
16
?
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.