从WCF服务的响应结果生成XML

本文关键字:XML 结果 响应 WCF 服务 | 更新日期: 2023-09-27 18:06:10

我想在wcf中从我的服务响应的结果中生成一个xml,这里是我的部分代码,我不能在以下代码中记录" servicerresult ":

public object InvokeEnd(object instance, out object[] outputs, IAsyncResult result)
{
    logger.InfoFormat("InvokeEnd Start command operation:{0}", this.operationName);                        
    var serviceResult =  this.invoker.InvokeEnd(instance, out outputs, result);
    logger.InfoFormat("Method {0} - Result :{1}", this.operationName, result.ToString());
    return serviceResult;
}

从WCF服务的响应结果生成XML

你能做一些XML序列化吗?

就像这样:

System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer(p.GetType());
x.Serialize(Console.Out,p);
Console.WriteLine();
Console.ReadLine();

从:https://support.microsoft.com/en-us/kb/815813