开发者

get attachment from System.ServiceModel.Channels.Message

开发者 https://www.devze.com 2023-02-10 03:01 出处:网络
Does any one know how to get attachment from System.ServiceModel.Channels.Message? When client requests from the server, and server is returnin开发者_JAVA技巧g a xop element with attachment in the res

Does any one know how to get attachment from System.ServiceModel.Channels.Message? When client requests from the server, and server is returnin开发者_JAVA技巧g a xop element with attachment in the response. But I don't know how to get the attachment from the Message obj returned from the service call.


I don't fully understand all the circumstances, but there are several options the first is to use appropriate message encoder in binding, for example CustomBinding with MtomMessageEncodingBindingElement element. In that case, XmlDictionaryReader returned by Message.GetReaderAtBodyContents() will automatically replace xop:Include elements by corresponding attachment. In case, if there are needs to manipulate attachments at lower level, or in case if non-MTOM encoding is used, you will need to write appropriate message encoder that will meets you requirements.

0

精彩评论

暂无评论...
验证码 换一张
取 消