【问题标题】:Replacing XopDocument class in .NET 4.0在 .NET 4.0 中替换 XopDocument 类
【发布时间】:2011-04-27 01:20:48
【问题描述】:

随着迁移到 .NET 4.0,我们摆脱了很多 WSE 库,包括 XopDocument 类。替换 XopDocument 类的推荐类是什么,它表示一个 XOP 包,它是 MTOM 编码的 SOAP 消息的一部分

【问题讨论】:

    标签: c# .net-4.0 wse xop


    【解决方案1】:

    今天我在尝试了解如何向 SOAP 消息添加一些附件时发现了您的问题。在我的要求中,我有示例 SOAP,其中<inc:Include href="cid:SOMEXML" xmlns:inc="http://www.w3.org/2004/08/xop/include"/> 并且我必须实现可以使用此类请求的服务。我在 WSE 方面没有经验,所以我很感兴趣 XopDocument 在那里使用的目的。
    我使用 WCF 配置解决了我的问题。我设置messageEncoding="Mtom"

      <basicHttpBinding>
        <binding messageEncoding="Mtom" />
      </basicHttpBinding>
    

    我的 DataContract 有 byte[] 属性。

    [DataContract]
    public class RootObject
    {
        [DataMember]
        public byte[] SOMEXML { get; set; }
    }
    

    在 SOAP 请求中看起来像

    <xop:Include href="cid:http%3A%2F%2Ftempuri.org%2F1%2F634654497430144369" xmlns:xop="http://www.w3.org/2004/08/xop/include"/>
    

    总的来说,这是我想要找到的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-08-08
      • 2012-11-02
      • 2012-08-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多