本文介绍了WCF的MessageHeader VS messagebodymember?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不明白的时候,我应该把[的MessageHeader]的而不是[MessageBodyMember]

I do not understand when I should put the [MessageHeader] instead of the [MessageBodyMember]?

我有,它的使用,以符合某种协议像肥皂,不过,这是什么在最后更改?

I have read that it's used to conform some protocol like Soap, but still, what does it change at the end?

推荐答案

SOAP是一个协议,其中每个消息(请求或响应)是由两部分组成:在标题正文,里面的信封

SOAP is a protocol in which each message (request or response) is made up of two parts: the Header and the Body, inside an Envelope:

<s:Envelope xmlns:s='the namespace for the soap version'>
  <s:Header>
    <!-- SOAP headers will come here -->
  </s:Header>
  <s:Body>
    <!-- SOAP body members will come here -->
  </s:Body>
</s:Envelope>

您通常不会使用[MessageContract](和的MessageHeader或MessageBodyMember)的WCF服务,只有当你真正需要互操作与预期有一定格式的数据一些第三方。

You normally wouldn't use [MessageContract] (and MessageHeader or MessageBodyMember) in WCF services, only if you really need to interop with some 3rd party which expects the data in a certain format.

这篇关于WCF的MessageHeader VS messagebodymember?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-25 03:12