根据 wcf 服务的响应结果生成 xml

make xml from result of wcf service's response

我想根据我的服务在 wcf 中的响应结果生成 xml,这是我无法在以下代码中记录 "serviceresult" 的部分代码:

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;
}

你能做一些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