根据wcf服务的响应结果制作xml

时间:2015-08-03 14:04:23

标签: c# web-services wcf logging log4net

我想在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;
}

1 个答案:

答案 0 :(得分:0)

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