0

调用Workday API Assign_Costing_Allocation时,突然出现 XML 生成错误:

System.ServiceModel.CommunicationException
  HResult=0x80131501
  Message=There was an error in serializing body of message Assign_Costing_AllocationInput: 'There was an error generating the XML document.'.  Please see InnerException for more details.
  Source=mscorlib
  StackTrace:
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at PostBudget.PayrollService.PayrollPort.Assign_Costing_Allocation(Assign_Costing_AllocationInput request)
...
Inner Exception 1:
InvalidOperationException: There was an error generating the XML document.

Inner Exception 2:
InvalidOperationException: The type PostBudget.PayrollService.Tenanted_Payroll_WorktagObjectIDType was not expected. Use the XmlInclude or SoapInclude attribute to specify types that are not known statically.

PostBudget.PayrollService.Tenanted_Payroll_WorktagObjectIDType 在 References.cs 中提供,自动生成并具有序列化标签:

    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.2612.0")]
    [System.SerializableAttribute()]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:com.workday/bsvc")]
public partial class Tenanted_Payroll_WorktagObjectIDType : object, System.ComponentModel.INotifyPropertyChanged { ... }

如何调试这个?我能做些什么来完成这项工作?

4

1 回答 1

0

从 WSDL 生成的 References.cs 中存在错误,列出了不正确的类型 Tenanted_Payroll_WorktagObjectType,而不是需要 Tenanted_Payroll_WorktagObjectIDType 的 Tenanted_Payroll_WorktagObjectIDType。手动更改自动生成的文件解决了这个问题。

于 2018-05-22T21:15:16.120 回答