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.
精彩评论