Adding a web service at runtime

  • Thread starter Thread starter Simon Tamman {Uchiha Jax}
  • Start date Start date
S

Simon Tamman {Uchiha Jax}

Wondering how difficult this will be to do.

The principle being that the application will load a URL from a
configuration file at runtime and then add a reference to the web service.
Only having ever added a Web Reference from Visual Studio at buildtime i'm
unsure of how to perform this task.
When you add a "web reference" in this way it appears as a distinct type,
i'm assuming this means that i'll have to load the type in at runtime and
use reflection to invoke the members that are required.

Is it even possible?

Please let me know if you have any information that will help me work this
out.

Thankyou

Simon
 
Simon,

You won't need to do this. Rather, you can create an instance of the
SoapHttpClientProtocol and use that. This is the base of the proxy classes
when you create a web reference. Instead of using reflection, just create
this, and set the url properly.

Then, call the Invoke method to send requests to invoke web methods
(it's easier than the reflection code).

Hope this helps.
 
Further to what Nick says :)

check out for dynamic web service invocation

http://www.thinktecture.com/Resources/Software/DynWsLib/default.html


HTH

Ollie Riches


Nicholas Paldino said:
Simon,

You won't need to do this. Rather, you can create an instance of the
SoapHttpClientProtocol and use that. This is the base of the proxy
classes when you create a web reference. Instead of using reflection,
just create this, and set the url properly.

Then, call the Invoke method to send requests to invoke web methods
(it's easier than the reflection code).

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

"Simon Tamman {Uchiha Jax}"
Wondering how difficult this will be to do.

The principle being that the application will load a URL from a
configuration file at runtime and then add a reference to the web
service.
Only having ever added a Web Reference from Visual Studio at buildtime
i'm
unsure of how to perform this task.
When you add a "web reference" in this way it appears as a distinct type,
i'm assuming this means that i'll have to load the type in at runtime and
use reflection to invoke the members that are required.

Is it even possible?

Please let me know if you have any information that will help me work
this
out.

Thankyou

Simon
 
Thank you Nicholas and Ollie for replying.
You've definately given me a decent starting point to work from and I can
hopefully set this up "quickly".

For the sake of completing a quote for a client before fully spiking this,
do you how much work is involved in setting something like this up? (sorry
if it's cheeky to ask this :) )
Is this a relatively simple thing to implement or is it fraught with issues
and complexity?

Kind Regards

Simon


Ollie Riches said:
Further to what Nick says :)

check out for dynamic web service invocation

http://www.thinktecture.com/Resources/Software/DynWsLib/default.html


HTH

Ollie Riches


message news:[email protected]...
Simon,

You won't need to do this. Rather, you can create an instance of the
SoapHttpClientProtocol and use that. This is the base of the proxy
classes when you create a web reference. Instead of using reflection,
just create this, and set the url properly.

Then, call the Invoke method to send requests to invoke web methods
(it's easier than the reflection code).

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

"Simon Tamman {Uchiha Jax}"
Wondering how difficult this will be to do.

The principle being that the application will load a URL from a
configuration file at runtime and then add a reference to the web
service.
Only having ever added a Web Reference from Visual Studio at buildtime
i'm
unsure of how to perform this task.
When you add a "web reference" in this way it appears as a distinct type,
i'm assuming this means that i'll have to load the type in at runtime and
use reflection to invoke the members that are required.

Is it even possible?

Please let me know if you have any information that will help me work
this
out.

Thankyou

Simon
 
if you use all the example code available on the net then it is very quick
to get something working, but if you want a more indepth understanding of
what is going on then it could take a couple of weeks to become completely
familar with what is required.

In general the examples problaby will do at least 90% of what you want to do
but not all of it and this is where it will take more time to learn what is
required to complete your task

HTH

Ollie Riches

"Simon Tamman {Uchiha Jax}"
Thank you Nicholas and Ollie for replying.
You've definately given me a decent starting point to work from and I can
hopefully set this up "quickly".

For the sake of completing a quote for a client before fully spiking this,
do you how much work is involved in setting something like this up? (sorry
if it's cheeky to ask this :) )
Is this a relatively simple thing to implement or is it fraught with
issues
and complexity?

Kind Regards

Simon


Ollie Riches said:
Further to what Nick says :)

check out for dynamic web service invocation

http://www.thinktecture.com/Resources/Software/DynWsLib/default.html


HTH

Ollie Riches


message news:[email protected]...
Simon,

You won't need to do this. Rather, you can create an instance of
the
SoapHttpClientProtocol and use that. This is the base of the proxy
classes when you create a web reference. Instead of using reflection,
just create this, and set the url properly.

Then, call the Invoke method to send requests to invoke web methods
(it's easier than the reflection code).

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

"Simon Tamman {Uchiha Jax}"
Wondering how difficult this will be to do.

The principle being that the application will load a URL from a
configuration file at runtime and then add a reference to the web
service.
Only having ever added a Web Reference from Visual Studio at buildtime
i'm
unsure of how to perform this task.
When you add a "web reference" in this way it appears as a distinct type,
i'm assuming this means that i'll have to load the type in at runtime and
use reflection to invoke the members that are required.

Is it even possible?

Please let me know if you have any information that will help me work
this
out.

Thankyou

Simon
 
Thank you Ollie. The sample is great and your advice is greatly appreciated.

Considering both my conscience and the warnings on the bottom of the page
(from the URI you gave) i'd really want to familiarise myself with both the
concepts and the code at hand rather than just bunging in the example
without really looking, especially since the code is for a client.

2 weeks on the outside then. I'll properly spike it tomorrow.
Thank you!

Simon

Ollie Riches said:
if you use all the example code available on the net then it is very quick
to get something working, but if you want a more indepth understanding of
what is going on then it could take a couple of weeks to become completely
familar with what is required.

In general the examples problaby will do at least 90% of what you want to do
but not all of it and this is where it will take more time to learn what is
required to complete your task

HTH

Ollie Riches

"Simon Tamman {Uchiha Jax}"
Thank you Nicholas and Ollie for replying.
You've definately given me a decent starting point to work from and I can
hopefully set this up "quickly".

For the sake of completing a quote for a client before fully spiking this,
do you how much work is involved in setting something like this up? (sorry
if it's cheeky to ask this :) )
Is this a relatively simple thing to implement or is it fraught with
issues
and complexity?

Kind Regards

Simon


Ollie Riches said:
Further to what Nick says :)

check out for dynamic web service invocation

http://www.thinktecture.com/Resources/Software/DynWsLib/default.html


HTH

Ollie Riches


"Nicholas Paldino [.NET/C# MVP]" <[email protected]>
wrote
in
message Simon,

You won't need to do this. Rather, you can create an instance of
the
SoapHttpClientProtocol and use that. This is the base of the proxy
classes when you create a web reference. Instead of using reflection,
just create this, and set the url properly.

Then, call the Invoke method to send requests to invoke web methods
(it's easier than the reflection code).

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

"Simon Tamman {Uchiha Jax}"
Wondering how difficult this will be to do.

The principle being that the application will load a URL from a
configuration file at runtime and then add a reference to the web
service.
Only having ever added a Web Reference from Visual Studio at buildtime
i'm
unsure of how to perform this task.
When you add a "web reference" in this way it appears as a distinct type,
i'm assuming this means that i'll have to load the type in at
runtime
and
use reflection to invoke the members that are required.

Is it even possible?

Please let me know if you have any information that will help me work
this
out.

Thankyou

Simon
 
Back
Top