Invoking a Web Service dynamically without adding a Web Reference

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I need to invoke a web service dynamically at runtime without adding a web
reference. I need to do this through a C# application (.NET 2.0).
At runtime my application will get the url of the web service and the web
method to be invoked.

Can someone please let me know how this can be done.

Thanks in advance,
Rakesh
 
Without a web reference to the proxy, you probably wont be able to compile
method calls into your code, so you'll need to revert to composing GET
requests using the information you have - URL and method call + parameters
it requres. Easy to do if the web service allows GET request.

An alternative would be to create dynamic SOAP requests, and you can read
about that here:
http://www.eggheadcafe.com/articles/20011103.asp

Regards

John Timney (MVP)
 
Hi John,

Thanks for the quick response!!
I was actually looking at creating a SAOP packet dynamically and using
HttpWebRequest to make the SOAP request. But is there a way using which I can
get the format of the SOAP packet from the WSDL at runtime. The sample
provided at http://www.eggheadcafe.com/articles/20011103.asp assumes that the
format of the SOAP request is already know. But in my case, that wont be the
case. Is there a utility provided using which the SOAP packet can be formated
at runtime from the WSDL.

Thanks and Regards,
Rakesh
 
Hi John,

Thanks for pointing me to the right direction. Got it working using the MS
SOAP toolkit.

Thanks and Regards,
Rakesh
 
Back
Top