vb.net - How can I call a WCF service from code, in the .net framework 3 -
i'm working in vb.net , i'm trying make piece of code more generic.
in fact, there's big select case statement build proxyserver based on value passed in parameter (a string).
select case _strnterahl7 case constantes.nomprpmin306010 strurl = obtenirurl("providerdetailsquery", _strversion, _strenvir, true, _blnsimulcais, _blnsimulpds, _blnsimulpdssiir, _blnsimulpdsinteg) objwshl7 = new wsproviderdetailsquery.providerdetailsqueryclient(objbinding, new endpointaddress(strurl)) case constantes.nomprpmin301010 strurl = obtenirurl("addprovider", _strversion, _strenvir, true, _blnsimulcais, _blnsimulpds, _blnsimulpdssiir, _blnsimulpdsinteg) objwshl7 = new wsaddprovider.addproviderclient(objbinding, new endpointaddress(strurl))
the objects "wsaddprovider" , "wsproviderdetailsquery" in previous example service references have been added through gui of visual studio...
what want know, basically, if can call constructor pool containing service references, similar when want call control in controls container...
for example:
objwshl7 = new wcfservicescontainer("servicenamehere", paramarray())
or similar, can remove big switch cases, repeat same thing 30 times.
objwshl7 being object or type "object" @ compiling.
sorry if didn't mention enough detail, feel free let me know if need more, don't know information have provide this.
edit: i've spotted piece of code here uses similar calls, maybe it'll understanding...
again, in switch case statement,
objmsghl7out = _objwshl7.providerdetailsquery(_objmsgin)
objmsghl7out system.servicemodel.channels.message _objmsgin system.servicemodel.channels.message _objwshl7 object
try this:
- create hashmap of
hashmap<string, string>
- add
constantes.nomprpmin306010
, ... key ,"addprovider"
, ... value. - call
obtenirurl(hashmap[_strnterahl7], ...
Comments
Post a Comment