I need to post an Image to wcf service and service will perform some operations on image and response back image. How to do that? I need help on both sides android and wcf
Asked
Active
Viewed 137 times
1 Answers
0
Yep, that is easy as long as you are accepting and returning Stream
and using WebHttpBinding
. See Can a WCF REST endpoint be forced to accept Raw message format? and How to: Create a Service That Returns Arbitrary Data Using The WCF Web HTTP Programming Model
Basically as follows:
[WebInvoke(Method = "POST", UriTemplate = "processImage")]
public Stream ProcessImage(Stream inputImage)
{
// do stuff with inputImage
WebOperationContext.Current.OutgoingResponse.ContentType = "image/jpeg";
return /* some stream with jpeg data */;
}
From the client, you are just posting an HTTP request. See Sending images using Http Post but use the resultant HttpResponse
to access the returned image.