// Invoice_Delivery_Log LogTable = new Invoice_Delivery_Log(); static void Main(string[] args) { // GlobalEntity.Invoice_Delivery_Log. // GlobalEntity.SaveChanges(); // GlobalEntity.Invoice_Delivery_Log.Add(new Invoice_Delivery_Log { }); System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12; SecurityBindingElement sb = SecurityBindingElement.CreateUserNameOverTransportBindingElement(); sb.IncludeTimestamp = false; const int lim = Int32.MaxValue; var timeout = TimeSpan.FromMinutes(5); var cb = new CustomBinding( sb, new TextMessageEncodingBindingElement(MessageVersion.Soap11, Encoding.UTF8) { ReaderQuotas = new XmlDictionaryReaderQuotas { MaxDepth = lim, MaxStringContentLength = lim, MaxArrayLength = lim, MaxBytesPerRead = lim, MaxNameTableCharCount = lim } }, new HttpsTransportBindingElement { MaxBufferPoolSize = lim, MaxReceivedMessageSize = lim, MaxBufferSize = lim, Realm = string.Empty }) { SendTimeout = timeout, ReceiveTimeout = timeout }; Resource_ManagementPortClient RCM = new Resource_ManagementPortClient(cb, new EndpointAddress("https://wd2-impl-services1.workday.com/ccx/service/leggmason8/Resource_Management/v33.1")); //// Specify the username and password for RCM.ClientCredentials.UserName.UserName = "******"; RCM.ClientCredentials.UserName.Password = "******"; RCM.ClientCredentials.Windows.ClientCredential.UserName = "******"; RCM.ClientCredentials.Windows.ClientCredential.Password = "******"; RCM.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation; RCM.ClientCredentials.UseIdentityConfiguration = true; RCM.ClientCredentials.Windows.AllowNtlm = true; basic_validation(RCM); }
static async Task Main(string[] args) { var root = new RootCommand("WDTest attempts to use the UWD.Lib") { new Option <string>("-u", description: "Workday username") { IsRequired = true }, new Option <string>("-p", description: "Workday password") { IsRequired = true }, new Option <string>("--url", () => "https://wd5-impl-services1.workday.com/ccx/service/uw11/Resource_Management/v35.0/", description: "Workday root url (optional)") { IsRequired = false } }; root.Handler = CommandHandler.Create <string, string, string>(async(u, p, url) => { var binding = new BasicHttpsBinding(); var endpoint = new EndpointAddress(url); var client = new Resource_ManagementPortClient(binding, endpoint); client.Endpoint.EndpointBehaviors.Add(new AuthenticationBehavior(new WorkdayCredentials { Username = u, Password = p })); client.Endpoint.Binding.SendTimeout = TimeSpan.FromSeconds(30); Console.WriteLine("Starting test..."); var sw = Stopwatch.StartNew(); try { var resp = await client.Get_Invoice_TypesAsync(new Workday_Common_HeaderType(), new Get_Invoice_Types_RequestType()); Console.Write($"Success! {sw.Elapsed}"); } catch (FaultException fe) { Console.WriteLine($"FAULT {fe.GetFriendlyType()} after {sw.Elapsed}"); Console.WriteLine(fe.ToString()); } catch (Exception e) { Console.WriteLine($"ERROR {e.GetFriendlyType()} after {sw.Elapsed}"); Console.WriteLine(e.ToString()); } }); await root.InvokeAsync(args); }
public static void basic_validation(Resource_ManagementPortClient RCM) { Dictionary <string, List <MyXmlData> > filesinfo = readPDF(@"C:\File_Repo\XML"); Console.WriteLine("***Total FILE FOUND*** :" + filesinfo.Count); if (filesinfo.Count > 0) { InvoiceModel readyinvoicemodel = null; int count = 0; foreach (var xmlitem in filesinfo) { readyinvoicemodel = mapto_invoice_model(xmlitem); Console.WriteLine("Processing File -:" + xmlitem.Key); try { if (readyinvoicemodel.OCR_Image_Name == "") { Console.WriteLine("pdf file not located"); } Process_Invoce_Request(RCM, readyinvoicemodel); } catch (Exception Ex) { // int count = 0 Console.WriteLine("STATUS:Failed To save to work day with File Name-:" + xmlitem.Key); Console.WriteLine("***Exception***"); Console.WriteLine(Ex.Message); Console.WriteLine("......................................................................................................................................................................"); continue; // throw Ex; ; } } } else { Console.WriteLine("No file to read"); } }
public static void Process_Invoce_Request(Resource_ManagementPortClient RCM, InvoiceModel invoicemodel) { Submit_Supplier_Invoice_RequestType SSIR = new Submit_Supplier_Invoice_RequestType(); //Console.WriteLine("Taking Dicession based on OCR_PO_Number"); if (string.IsNullOrEmpty(invoicemodel.OCR_PO_Number)) { Console.WriteLine("***NON_PO_INVOICE***"); SSIR.Supplier_Invoice_Data = process_NON_PO_Invoice(invoicemodel); } else { Console.WriteLine("PO invoice,with OCR_PO_Number in XML: " + invoicemodel.OCR_PO_Number); SSIR.Supplier_Invoice_Data = process_po_Invoice(invoicemodel); Console.WriteLine("Ready to Push to WorkDay"); } SSIR.Business_Process_Parameters = new Financials_Business_Process_ParametersType() { Auto_Complete = false }; SSIR.Add_Only = true; // SSIR.version = "33.1"; try { Log_To_Console(SSIR); var objres = RCM.Submit_Supplier_Invoice(SSIR); Console.WriteLine("Success with WorkDay ID :- " + objres.Supplier_Invoice_Reference.ID[0].Value); } catch (Exception ex) { throw ex; } }