Book Image

WCF Multi-layer Services Development with Entity Framework - Fourth Edition

By : Mike Liu
Book Image

WCF Multi-layer Services Development with Entity Framework - Fourth Edition

By: Mike Liu

Overview of this book

Table of Contents (20 chapters)
WCF Multi-layer Services Development with Entity Framework Fourth Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
2
Hosting the HelloWorld WCF Service
Index

Testing the RESTful service in a browser


We have finished modifying the existing NorthwindService to be a RESTful WCF service. Before building our own client to test it, let's test it with a browser.

To test the RESTful WCF service, first rebuild the solution, then open Internet Explorer and enter the following URL in the address bar of the browser: http://localhost/RESTNorthwindService/ProductService.svc/Product/5.

Depending on your browser's settings, you might be prompted to open/save the response file, or you might get the following content displayed on your browser:

{"Discontinued":true,"ProductID":5,"ProductName":
"Chef Anton's Gumbo Mix","QuantityPerUnit":"36 boxes","RowVersion":[0,0,0,0,0,0,7,252],
"UnitPrice":21.3500}

This shows the JSON-formatted details of the product with ID 5.

Now if you try to call the UpdateProduct method on the browser, you will get a response that says Method not allowed. As this is a POST method, we have to create a client to submit a POST request to the service...