Dynamic Web Service Reference

S

Scott Allen

Hi Demetri:

I'd start by looking at the ServiceDescriptionReflector and
ServiceDescriptionImporter classes from
System.Web.Services.Description. From here you could essentially write
your own WSDL.exe tool that compiles proxies in memory.
 
B

bruce barker

no. a web service reference builds a proxy stub for the webservice. it
creates a class with a method for each web service method, with a matching
parameter list. the method call the web service and returns the results. at
runtime you can change the URL if you want.

if you want to dynamically call a web service at runtime, your fetch its
WDSL, and use the .net libraries to parse it, and make the call. you could
build the proxy at runtime using the wsdl.exe tool to generate the source
code, then compile and load the dll. after loading you could use reflection
to make the calls.

-- bruce (sqlwork.com)
 
G

Guest

Basically, what I want is to have the development version, testing version,
and production versions of the web application to consume the appropriate web
service version (dev, test, prod - respectively). What is the best way to
accomplish this without having to create a separate project for each
environment so it can have its own web references?

Thanks
-Demetri
 
S

Scott Allen

Hi Demetri:

It sounds as if you need to point the proxy classes at the correct
URL. This would be an easier problem than we first thought. Set the
UrlBehavior property to Dynamic in the properties window and the IDE
will add a section to the application's config file with the URL for
the service. I.e:

<configuration>
<appSettings><add key="SomeProject.localhost.Service1"
value="http://localhost/SomeWebService/Service1.asmx"/>
</appSettings>
</configuration>

HTH,
 
G

Guest

Great!! That solves my problem.

Thanks!!

Scott Allen said:
Hi Demetri:

It sounds as if you need to point the proxy classes at the correct
URL. This would be an easier problem than we first thought. Set the
UrlBehavior property to Dynamic in the properties window and the IDE
will add a section to the application's config file with the URL for
the service. I.e:

<configuration>
<appSettings><add key="SomeProject.localhost.Service1"
value="http://localhost/SomeWebService/Service1.asmx"/>
</appSettings>
</configuration>

HTH,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top