//public string InquireRequisition(string ReqID, string UserName, string Password) //{ // string returnValue = string.Empty; // ERMA.IVRequisition.ivpwsNPO001PortTypeClient client = new ERMA.IVRequisition.ivpwsNPO001PortTypeClient("ivpwsNPO001HttpSoap12Endpoint"); // // set so that service manager uses custom credentials class instead of default. // client.ChannelFactory.Endpoint.Behaviors.Remove<System.ServiceModel.Description.ClientCredentials>(); // client.ChannelFactory.Endpoint.Behaviors.Add(new CustomCredentials()); // // set the credentials and path to the certificate. // client.ClientCredentials.UserName.UserName = UserName; // client.ClientCredentials.UserName.Password = Password; // client.ClientCredentials.ClientCertificate.SetCertificate(System.Security.Cryptography.X509Certificates.StoreLocation.LocalMachine, System.Security.Cryptography.X509Certificates.StoreName.My, System.Security.Cryptography.X509Certificates.X509FindType.FindBySerialNumber, "4d 00 eb c7"); // InquirePoRequisitionerCodeRequest request = new InquirePoRequisitionerCodeRequest(); // //Service_UpdatePORequisitionType // UpdatePORequisitionRequest requisitionRequest = new UpdatePORequisitionRequest(); // return string.Empty; //} public string AddRequisition(ReqDetail rd, string UserName, string Password) { string returnValue = string.Empty; ERMA.IVRequisition.ivpwsNPO001PortTypeClient client = new ERMA.IVRequisition.ivpwsNPO001PortTypeClient("ivpwsNPO001HttpSoap12Endpoint"); // set so that service manager uses custom credentials class instead of default. client.ChannelFactory.Endpoint.Behaviors.Remove <System.ServiceModel.Description.ClientCredentials>(); client.ChannelFactory.Endpoint.Behaviors.Add(new CustomCredentials()); // set the credentials and path to the certificate. client.ClientCredentials.UserName.UserName = UserName; client.ClientCredentials.UserName.Password = Password; client.ClientCredentials.ClientCertificate.SetCertificate(System.Security.Cryptography.X509Certificates.StoreLocation.LocalMachine, System.Security.Cryptography.X509Certificates.StoreName.My, System.Security.Cryptography.X509Certificates.X509FindType.FindBySerialNumber, "4d 00 eb c7"); AddPORequisitionRequest request = new AddPORequisitionRequest(); Service_AddPORequisitionType addReq = new Service_AddPORequisitionType(); //InquirePoRequisitionerCodeRequest addReq.ServPlntCod = rd.ServPlntCode; addReq.ServLang = rd.ServLang; addReq.MasterRequisitionNbrSpecified = rd.MasterRequisitionNbrSpecified; addReq.CMSDataBase = rd.CMSDatabase; addReq.MasterRequisitionNbr = rd.MasterRequisitionNumber; addReq.RequestID = rd.RequestID; addReq.RequestMode = rd.RequestMode; addReq.PlantCode = rd.ServPlntCode; //DFT addReq.ItemType = " "; addReq.RequisitionNumberSpecified = rd.RequisitionNumberSpecified; addReq.VendorPartNumber = rd.VendorPartNumber; addReq.PartNumber = rd.TACPartNumber; addReq.QuantityOrdered = rd.Qty; addReq.QuantityOrderedSpecified = rd.QtyOrderedSpecified; addReq.PriceUnit = rd.UnitOfMeasure; addReq.OrderUnit = rd.OrderUnit; addReq.UnitPrice = Convert.ToDecimal(rd.PerUnitPrice); addReq.UnitPriceSpecified = true; addReq.DateRequired = rd.RequiredDate; if (!(rd.ProjectCode is null)) { if (rd.ProjectCode != "0") { addReq.ProjectNumber = rd.ProjectCode.Trim().ToUpper(); } else { addReq.ProjectNumber = ""; } }
/// <summary> /// Constructor. /// </summary> public Program() { // set the client to use SOAP 1.2 //CMSwsIV001PortTypeClient client = new CMSwsIV001PortTypeClient("CMSwsIV001HttpSoap12Endpoint"); ERMA.IVRequisition.ivpwsNPO001PortTypeClient client = new ERMA.IVRequisition.ivpwsNPO001PortTypeClient("CMSwsIV001HttpSoap12Endpoint"); // set so that service manager uses custom credentials class instead of default. client.ChannelFactory.Endpoint.Behaviors.Remove <System.ServiceModel.Description.ClientCredentials> (); client.ChannelFactory.Endpoint.Behaviors.Add(new CustomCredentials()); // set the credentials and path to the certificate. client.ClientCredentials.UserName.UserName = "******"; client.ClientCredentials.UserName.Password = "******"; client.ClientCredentials.ClientCertificate.SetCertificate(System.Security.Cryptography.X509Certificates.StoreLocation.LocalMachine, System.Security.Cryptography.X509Certificates.StoreName.My, System.Security.Cryptography.X509Certificates.X509FindType.FindBySerialNumber, "4b 56 0e 01"); //inquireGlobalPart(client); inquireGlobalRequisition(client); }