Stubbing RESTful services with WCF (Part 2) - Online Free Computer Tutorials.

'Software Development, Games Development, Mobile Development, iOS Development, Android Development, Window Phone Development. Dot Net, Window Services,WCF Services, Web Services, MVC, MySQL, SQL Server and Oracle Tutorials, Articles and their Resources

Tuesday, August 7, 2018

Stubbing RESTful services with WCF (Part 2)

A three part series. Part 1: The set-up. Setting up an example to show what we are trying to stub. Part 2: Creating a service stub. Part 3: Using the service stub from a test. Part 1 explained what we are trying to stub – and the first step in creating a service stub is to create a Service Contract interface that looks like the RESTful service we want to stub: [ServiceContract] public interface IServiceStub { [WebInvoke(ResponseFormat = WebMessageFormat.Xml, UriTemplate = "OrderingSystem/{entityType}/{entityId}", BodyStyle = WebMessageBodyStyle.Bare, Method = "GET")] [OperationContract] XElement GetEntity(string entityType, string entityId); [WebInvoke(ResponseFormat = WebMessageFormat.Xml, UriTemplate = "OrderingSystem/{entityType}/{entityId}/{childEntityType}", BodyStyle = WebMessageBodyStyle.Bare, Method = "GET")] [OperationContract] XElement GetChildEntity(string entityType, string entityId, string childEntityType); } ServiceContractAttribute is in System.ServiceModel and WebInvokeAttribute is in System.


I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too.

Stay tuned to my blogtwitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.


This article is related to

.NET,Test Driven Development,WCF,REST,Stubbing RESTful Services,TDD

No comments:

Post a Comment