Wcf service return binary data
You can also upload media resource data as a binary stream. Then you can read the straem and wrap inside response object send back to client. To insert or update a media resource, call the SetSaveStream method on the DataServiceContext instance that is tracking the entity.
An entity that has a related media resource stream is indicated in the data service metadata by the HasStream attribute applied to an entity type that is the media link entry. So for testing the xml file, I changed the code in the service. If you are creating test messages by hand or in a testing tool, you also need to know how to represent binary data in a SOAP message. Premium members can enroll in this course at no extra cost.
You can also upload media resource data as a binary stream. For debug convince, please enable exception detail, to do this, open web. Check below sample where it returns a stream from wcf service.
The following example shows how to call the GetReadStream method to retrieve a stream that is used to create a new image on the client:. Sep 19, Flush ;" method vijayakrishna I am not much familiar with web services. You can also upload media resource data as a binary stream. Question has a verified solution.
These file details may be useful for setting up the content-type of the response and attachment name as well. But while adding the servicereferece to client application I get error as specfied in the attached screenshot. Get a personalized answer when you ask a related question. Read ba,10, int fs.
Read ba,10, int fs. Configuring a data service to support the streaming of binary data requires the following steps: In this case, the binary property is an entity property exposed by the data model, and wcf service return binary data data service serializes the binary data as base binary encoded XML in the response message.