Link to home
Start Free TrialLog in
Avatar of Michael Lam
Michael Lam

asked on

dynamically reference a web service

let's say i have a console app written in c#, and part of the command line argument is the url of a web service (e.g. xxx.asmx) that i need to call.  would it be possible to dynamically reference the web service (WS) upon retrieving the url?  or do you must first do a service reference first?  
Avatar of JamesAperta
JamesAperta

yes you can do that.  check out the following....

http://www.codeproject.com/KB/webservices/Dynamic_Invoke_webservice.aspx
Avatar of Éric Moreau
you need to first add the web reference and at run time you replace the URL property of your reference. this exactly the same process as switching from development to production.
Avatar of Michael Lam

ASKER

i  am sorry, the CTO had a change of heart, we are now using WCF services.  the method in the codeproject website doesn't work for WCF services.
ASKER CERTIFIED SOLUTION
Avatar of JamesAperta
JamesAperta

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial