我正在使用以下 WSDL 并尝试在 Workday 中保存
我已经按照工作日 API 中提到的步骤(https://community.workday.com/articles/946)..在生成的源代码中使用 [] 删除 [][] 之后。
我面临以下问题。System.InvalidOperationException:
'有一个错误反映'Submit_Supplier_Contract_Amendment_Response
InvalidOperationException:对于非数组类型,您可以使用以下属性:XmlAttribute、XmlText、XmlElement 或 XmlAnyElement。
这是源代码-
Resource_ManagementPortClient hr = new Resource_ManagementPortClient();
hr.Endpoint.Address = new EndpointAddress("https://community.workday.com/sites/default/files/file-hosting/productionapi/Resource_Management/v18/Resource_Management.wsdl");
//Specify the username and password for WS-Security UsernameToken Header
hr.ClientCredentials.UserName.UserName = "xxx";
hr.ClientCredentials.UserName.Password = "xxx";
CompanyObjectIDType[] cid = new CompanyObjectIDType[1];
cid[0] = new CompanyObjectIDType { type = "Company_Reference_ID", Value = "327" };
CurrencyObjectIDType[] currencyid = new CurrencyObjectIDType[1] { new CurrencyObjectIDType { type = "Currency_ID", Value = "USD" } };
Supplier_Invoice_RequestObjectIDType[] supplerrid = new Supplier_Invoice_RequestObjectIDType[1] { new Supplier_Invoice_RequestObjectIDType { type = "Supplier_ID", Value = "S-0000006695" } };
Payment_TermsObjectIDType[] paymentTerm = new Payment_TermsObjectIDType[1] { new Payment_TermsObjectIDType { type = "Payment_Terms_ID", Value = "NET0DAYS" } };
Spend_CategoryObjectType catobjtype = new Spend_CategoryObjectType()
{
ID = new Spend_CategoryObjectIDType[]{ new Spend_CategoryObjectIDType {
type="Spend_Category_ID",
Value="SC0374"
} }
};
Accounting_WorktagObjectType[] worktagobj =
new Accounting_WorktagObjectType[]{ new Accounting_WorktagObjectType { ID= new Accounting_WorktagObjectIDType[] { new Accounting_WorktagObjectIDType {
type="Cost_Center_Reference_ID",
Value="W5310"
} } } };
Supplier_Invoice_DataType sisd = new Supplier_Invoice_DataType();
sisd.Submit = true;
sisd.Company_Reference = new CompanyObjectType() { ID = cid };
sisd.Currency_Reference = new CurrencyObjectType() { ID = currencyid.ToArray() };
sisd.Supplier_Invoice_Request_Reference = new Supplier_Invoice_RequestObjectType() { ID = supplerrid.ToArray() };
sisd.Invoice_Date = DateTime.UtcNow;
sisd.Suppliers_Invoice_Number = "SupplierInvoiceNumber000020";
sisd.Payment_Terms_Reference = new Payment_TermsObjectType() { ID = paymentTerm.ToArray() };
sisd.Invoice_Line_Replacement_Data = new Supplier_Invoice_Line_Replacement_DataType[] { new Supplier_Invoice_Line_Replacement_DataType {
Extended_Amount=1234.56M,
Spend_Category_Reference= catobjtype,
Worktags_Reference = worktagobj
} };
//Instantiate Header for the request
Workday_Common_HeaderType header = new Workday_Common_HeaderType();
header.Include_Reference_Descriptors_In_Response = false;
header.Include_Reference_Descriptors_In_ResponseSpecified = false;
Submit_Supplier_Invoice_RequestType SSIR = new Submit_Supplier_Invoice_RequestType();
// SSIR.Business_Process_Parameters = new Financials_Business_Process_ParametersType() { Auto_Complete = false };
SSIR.Supplier_Invoice_Data = sisd;
SSIR.Business_Process_Parameters = new Financials_Business_Process_ParametersType() { Auto_Complete = false };
Exceptions_Response_Data.
try
{
var objres = hr.Submit_Supplier_Invoice(header, SSIR);
}
catch (Exception ex)
{
throw ex;
}
}