O'Reilly logo

Microsoft Windows Communication Foundation 4.0 Cookbook for Developing SOA Applications by Steven Cheng

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Implementing file download via REST endpoint

WCF REST services by default convert the response content of service operations into either XML or JSON format. However, these two formats are definitely not the only formats we can use for responses of REST operations. By customizing the OperationContract of a service operation, we can make the operation return any arbitrary format of data, such as image, text, ZIP package, or even raw binary files.

In this recipe, we will use a custom REST service that returns files to client consumers as an example to demonstrate how we can use a REST service endpoint to return data in a customized format.

How to do it...

To return custom format data in a WCF REST service, the most important thing is designing the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required