How to set Authetication values in dynamically called WSDL to call its methods
hi all
i need attention on asap,my issue goes below
i consuming webservice dynamically in code , not adding referrence
so have downloaded wsdl using webclient @ end , created proxy classes
and compiled using codedom,and extracted infos regarding methods following
//service dynamically created instance of web service
service = assembly.gettype("service1");
methodinfo = service.getmethods();
than have created instance of service using following , calling method using invoke method
var obj = activator.createinstance(service);
var response = t.invoke(obj, paramsarray);
now question works how set autheticationvalues required in method or soapheader
how pass creadentials web service method requires authenication parameters soapheader
now 1 interesting fact if go in quick watch window , if create new authetication() allows me , if set value of 2 properties called username , password , than
if , invoke mathod,it works , return result,but otherwise gives me error,now wanted ask is
how can achive compile time,how set authetication values method can
get executed,and returns result
thxs
note: have used webclient, soaphttpclientprotocol classes pass credentials not useful
if have service instance in "obj", , if know properties "username" , "password", can set them follows:
var type = obj.gettype(); var usernameproperty = type.getproperty("usrname"); usernameproperty.setvalue(obj, "joe user", new object[]{}); var passwordproperty = type.getproperty("password"); passwordproperty.setvalue(obj, "joe user's password", new object[]{});
john saunders
wcf is web services. not 2 separate things.
use wcf new web service development, instead of legacy asmx or obsolete wse
use file->new project create web service projects
Archived Forums A-B > ASMX Web Services and XML Serialization
Comments
Post a Comment