How to call Soap/mtom web service asynchronously from C# winform -
i attempting call/push semi-large tiff , gal file java webservice. platform visual studio 2013, c# windows forms application.
i pointing wsdl file , "the platform" generating service reference class me. abstracted me, thing relative newbie arena. left "generate task based code" checked , addsample , addsampleasync method.
i populate class fields , push code up.
the addsample code works fine blocks ui.
the async code, addsampleasync, works, bit slower , not asynchronous. addsampleasync locks ui half of processing time , function call fnctestupload not return same period of time.
//dimensioned @ class level //private static addsampleportclient service = new addsampleportclient(); //private static addsampleresponse myresult = new addsampleresponse(); //thisrequest wsdl modeled class object. //this code works, slow, 30 seconds on wifi responsetype myresult = service.addsample(thisrequest.request); messagebox.show(myresult.message + myresult.code); //this code locks ui 15 - 20 seconds takes 15 display messagebox fnctestupload(thisrequest); async void fnctestupload(addsamplerequest sentrequest) { myresult = await service.addsampleasync(sentrequest.request); messagebox.show(myresult.response.message + " - " + myresult.response.code); } i made response object class level variable in hopes of doing in function calls fnctestupload, thought return when calling async function. not return until after 15 seconds.??
i have spent several hours googling , have not found answers why addsampleasync not working advertised.
microsoft's tutorials may written in dilbert's elbonian. can't follow them , don't find them helpful, please don't direct me one.
when use 'await' keyword in method saying "ok, go ahead , work, return caller, let me know when you're done".
so 15 seconds of waiting time takes service process request, invoking state machine generated async method return method after awaited method has finished. normal behavior await.
about messagebox taking 15 seconds, response property lazyloading , trying load code / message first time wheb access properties.
Comments
Post a Comment