I have created a basic Custom Module (KC.CM.Divalto) that aims to:
- read data extracted from a batch
- call a webservice
- redirect to validation module or PDF generator depending on webservice response
I will output data into MessageBox for beginning.
At this stage, I read previous questions concerning Custom Modules and it helped me have a valid exe:
create custom module for pdf manipulation
internal class Program { static void Main(string[] args) { AppDomain.CurrentDomain.AssemblyResolve += (sender, eventArgs) => KcAssemblyResolver.Resolve(eventArgs); Run(args); return; } static void Run(string[] args) { var login = new Login(); login.EnableSecurityBoost = true; login.Login(); login.ApplicationName = "KC.CM.Divalto"; login.Version = "1.0"; login.ValidateUser("KC.CM.Divalto.exe", false, "", ""); var session = login.RuntimeSession; var activeBatch = session.NextBatchGet(login.ProcessID); MessageBox.Show("activeBatch.Name: " + activeBatch.Name); activeBatch.BatchClose( KfxDbState.KfxDbBatchReady, KfxDbQueue.KfxDbQueueNext, 0, ""); var url = "http://localhost/webservice.asmx"; var data1 = "data1"; var data2 = "data2"; var data3 = "data3"; Dictionary<string, string> data = new Dictionary<string, string>(); data.Add("data1", data1); data.Add("data2", data2); data.Add("data3", data3); WsCaller wsCaller= new WsCaller(); WsResponse returnValue = wsCaller.SoapApiCaller(url, data1, data2, data3); Console.WriteLine(returnValue); MessageBox.Show("returnValue" + returnValue); session.Dispose(); login.Logout(); }
}
Here my test call is working and returns the webservice response. I need to get extracted fields values in order to pass them to the webservice.
My questions are the following:
- how do i get the data from KTM Server (the values that are displayed in KTM Validation module)
- how do i bypass the validation module depending on webservice response ? I should go to PDF Generator module if webservice response is positive
- how do i pass values returned by my web service to validation module ? For example, I expect a status message with error message, or data from web service. I would like to set a property
Thanks