interface IVideoDateQueue
    {
        [OperationContract]
        [WebInvoke(
            UriTemplate = ""
            , Method = "POST"
            , ResponseFormat = WebMessageFormat.Xml
            , BodyStyle = WebMessageBodyStyle.Bare
            )]
         string GetVideoDate(string searchXml);    }
      public string GetVideoDate(string searchXml)
        {
            return "<?xml version=\"1.0\" encoding=\"utf-8\"?><data><a>123</a></data>";
        }
——————————————————————————————————————
返回的结果是  <string><?xml version=\"1.0\" encoding=\"utf-8\"?><data><a>123</a></data></string>
WCF 

解决方案 »

  1.   

    GetVideoDate方法返回一个 xml格式的字符串。  WCF最后返回的结果是 在 这个xml字符串外围加了一个<string></string>
      

  2.   

    你的确让它返回了string而不是返回xml对象,如果要返回xml对象,应该是返回XmlDocument这个类型才行,或者你直接返回Stream,这样它就不会对其做任何处理,原始内容是什么就是什么。
      

  3.   

    返回 XmlDocument类型,报如下错误:“/”应用程序中的服务器错误。
    无法序列化类型“System.Xml.XmlDocument”。请考虑将其标以 DataContractAttribute 特性,并将其所有要序列化的成员标以 DataMemberAttribute 特性。如果类型为集合,则请考虑将其标以 CollectionDataContractAttribute 特性。有关其他受支持的类型,请参见 Microsoft .NET Framework 文档。 Stream可以了,谢谢了