POST操作于Android图像WCF REST服务 [英] POSTing image from Android to WCF Rest Service

查看:132
本文介绍了POST操作于Android图像WCF REST服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

喜林:
<一href=\"http://vikaskanani.word$p$pss.com/2011/01/11/android-upload-image-or-file-using-http-post-multi-part/\" rel=\"nofollow\">http://vikaskanani.word$p$pss.com/2011/01/11/android-upload-image-or-file-using-http-post-multi-part/

要张贴图片到WCF REST服务。我不知道如何配置WCF REST服务,你能帮忙吗?
我现在的界面看起来是这样的:

To POST an image to a WCF Rest service. I do not know how do configure the WCF Rest Service, can you help? My current interface looks like this:

[OperationContract]
[WebInvoke(BodyStyle = WebMessageBodyStyle.Bare,
           UriTemplate = "SaveImage",
           Method = "POST")]
void SaveImage();

这是不行的......可能包含几个错误?

Which does not work... might contain several errors?

推荐答案

这是错误的。你应该送流参数为SaveImage方法的参数,而且最好设置TransferMode =StreamRequest在服务web.config文件。

It's wrong. You should send Stream argument as a parameter for SaveImage method, and it's better to set TransferMode="StreamRequest" in your service web.config.

在发布图像使用二进制/八位字节流内容类型和消息体的二进制数据。在服务器端 - 从流读取它

When POSTing image use binary/octet-stream content type and binary data in body of message. On server side - read it from stream.

这篇关于POST操作于Android图像WCF REST服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆