由网友(积极向丧)分享简介:我需要实现以下情形在WCF实现REST服务:I need to implement the following scenario in a REST service implemented in WCF:在用户提交的二进制文件和一组参数的服务器消耗的文件,做了一些聪明的工作,并生成一个二进制输出文件用户检索二进制...
我需要实现以下情形在WCF实现REST服务:
I need to implement the following scenario in a REST service implemented in WCF:
在用户提交的二进制文件和一组参数 的服务器消耗的文件,做了一些聪明的工作,并生成一个二进制输出文件 用户检索二进制结果文件和一切从客户角度来看,单个操作完成的。
and all that is done in a single operation from the client perspective.
It's pretty的容易在非REST服务。我该怎么做,在一个REST服务?从哪里开始?
It's pretty easy in a non-REST service. How do I do that in a REST service? Where do I get started?
推荐答案
由于您的链接的问题不直接有关串流HTTP当然你也可以在REST服务发送字节数组。下面是例如服务合同:
Since your linked question is not directly about streaming over HTTP you can of course send byte arrays in REST service. Here is example of service contract:
[ServiceContract]
public interface IService
{
[OperationContract]
[WebInvoke(Method = "POST")]
byte[] GetByteData(byte[] data);
}
数据将被发送为Base64 EN codeD字符串。发送消息的例子:
Data will be send as base64 encoded string. Example of send message:
<base64Binary xmlns="http://schemas.microsoft.com/2003/10/Serialization/">QmFzZSA2NCBTdHJlYW0=</base64Binary>
相关推荐
最新文章