web service传递stream二进制对象的解决方法

Web Service是一种跨平台的分布式解决方案,使用标准XML格式的SOAP消息传递信息,统一了不同平台的通讯协议,便于我们实现异构系统的交互;但使用统一的XML格式带来的问题就是此协议只支持基本的数据类型, 或包装了基本数据类型的简单对象,我们无法在.net中使用web service直接传递.net对象或二进制流,只有把对象或二进制流序列化为字符传才可以在web service中传递。下面介绍2种使用web service方式传递Stream对象的方法,希望给各位一些解决此类问题的思路:

方法1:

Code

方法2:

使用Microsoft的WSE(Web Services Enhancements)扩展web service:

"WSE 3.0 supports the Message Transmission Optimization Mechanism (MTOM) specification for transmitting large amounts of data to and from Web services."

Address:  http://msdn.microsoft.com/zh-cn/library/aa528822(en-us).aspx

Title:    How to: Enable a Web Service to Send and Receive Large Amounts of Data

原文地址:https://www.cnblogs.com/andy65007/p/1609584.html