I have a WCF Rest Service project set up serving JSON datastructures. I have defined a contract in an interface file like:
[OperationContract]
[WebInvoke(Method = "GET",
ResponseFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Bare,
UriTemplate = "location/{id}")]
Location GetLocation(string id);
Now the WebService needs to return multimedia (images, PDF documents) documents like a standard Web Server does. The WCF WebMessageFormat
of the ResponseFormat
only support JSON or XML. How do i define the method in the interface to return a file ?
Something like:
[OperationContract]
[WebInvoke(Method="GET",
ResponseFormat = ?????
BodyStyle = WebMessageBodyStyle.Bare,
UriTemplate = "multimedia/{id}")]
???? GetMultimedia(string id);
So that: wget http://example.com/multimedia/10
returns the PDF document with id 10.