WebService代码如下:
public DataTable GetDataFromSAP(DataTable varCondition)
{
ClaMM_Service.ClaZ_RFC_PUR obj = new ClaMM_Service.ClaZ_RFC_PUR();
DataTable dtResult = obj.Z_RFC_PUR(varCondition);
return dtResult;
}
在系统里调用代码如下:
MM.MM_Service obj = new MM.MM_Service();
dtFinal = obj.GetDeductDataFromSAP(dtRtn);
当调试到dtFinal = obj.GetDeductDataFromSAP(dtRtn);抛出异常:捕捉到InvalidOperationException 异常。生成 XML 文档时出错。
obj.GetDeductDataFromSAP(dtRtn);调试到方法内部去找问题~
System.InvalidOperationException: 生成 XML 文档时出错。 ---> System.InvalidOperationException: 无法序列化 DataTable。未设置 DataTable 名称。 在 System.Data.DataTable.WriteXmlSchema(XmlWriter writer, Boolean writeHierarchy) 在 System.Data.DataTable.System.Xml.Serialization.IXmlSerializable.WriteXml(XmlWriter writer) 在 System.Xml.Serialization.XmlSerializationWriter.WriteSerializable(IXmlSerializable serializable, String name, String ns, Boolean isNullable, Boolean wrapped) 在 Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write5_DataTable(Object o) 在 Microsoft.Xml.Serialization.GeneratedAssembly.DataTableSerializer.Serialize(Object objectToSerialize, XmlSerializationWriter writer) 在 System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id) --- 内部异常堆栈跟踪的结尾 --- 在 System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id) 在 System.Xml.Serialization.XmlSerializer.Serialize(TextWriter textWriter, Object o, XmlSerializerNamespaces namespaces) 在 System.Web.Services.Protocols.XmlReturnWriter.Write(HttpResponse response, Stream outputStream, Object returnValue) 在 System.Web.Services.Protocols.HttpServerProtocol.WriteReturns(Object[] returnValues, Stream outputStream) 在 System.Web.Services.Protocols.WebServiceHandler.WriteReturns(Object[] returnValues) 在 System.Web.Services.Protocols.WebServiceHandler.Invoke()
这个是在WebService里面写的y一个函数之后报的 错误 哪位大神可以解救一下 燃煤之际急