473,385 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Adding a web service at runtime

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
Nov 17 '05 #1
5 8002
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]
- mv*@spam.guard.caspershouse.com

"Simon Tamman {Uchiha Jax}"
<i_**********************************@NOSPAMhotmai l.com> wrote in message
news:BK************@newsfe7-gui.ntli.net...
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

Nov 17 '05 #2
Further to what Nick says :)

check out for dynamic web service invocation

http://www.thinktecture.com/Resource...b/default.html
HTH

Ollie Riches
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:uE**************@TK2MSFTNGP10.phx.gbl...
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]
- mv*@spam.guard.caspershouse.com

"Simon Tamman {Uchiha Jax}"
<i_**********************************@NOSPAMhotmai l.com> wrote in message
news:BK************@newsfe7-gui.ntli.net...
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


Nov 17 '05 #3
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" <ol**********@phoneanalyser.net> wrote in message
news:Or**************@TK2MSFTNGP14.phx.gbl...
Further to what Nick says :)

check out for dynamic web service invocation

http://www.thinktecture.com/Resource...b/default.html
HTH

Ollie Riches
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in message news:uE**************@TK2MSFTNGP10.phx.gbl...
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]
- mv*@spam.guard.caspershouse.com

"Simon Tamman {Uchiha Jax}"
<i_**********************************@NOSPAMhotmai l.com> wrote in message news:BK************@newsfe7-gui.ntli.net...
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



Nov 17 '05 #4
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}"
<i_**********************************@NOSPAMhotmai l.com> wrote in message
news:4B**************@newsfe4-gui.ntli.net...
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" <ol**********@phoneanalyser.net> wrote in message
news:Or**************@TK2MSFTNGP14.phx.gbl...
Further to what Nick says :)

check out for dynamic web service invocation

http://www.thinktecture.com/Resource...b/default.html
HTH

Ollie Riches
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote

in
message news:uE**************@TK2MSFTNGP10.phx.gbl...
> 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]
> - mv*@spam.guard.caspershouse.com
>
> "Simon Tamman {Uchiha Jax}"
> <i_**********************************@NOSPAMhotmai l.com> wrote in message > news:BK************@newsfe7-gui.ntli.net...
>> 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
>>
>>
>
>



Nov 17 '05 #5
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" <ol**********@phoneanalyser.net> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
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}"
<i_**********************************@NOSPAMhotmai l.com> wrote in message
news:4B**************@newsfe4-gui.ntli.net...
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" <ol**********@phoneanalyser.net> wrote in message
news:Or**************@TK2MSFTNGP14.phx.gbl...
Further to what Nick says :)

check out for dynamic web service invocation

http://www.thinktecture.com/Resource...b/default.html
HTH

Ollie Riches
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote
in
message news:uE**************@TK2MSFTNGP10.phx.gbl...
> 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]
> - mv*@spam.guard.caspershouse.com
>
> "Simon Tamman {Uchiha Jax}"
> <i_**********************************@NOSPAMhotmai l.com> wrote in

message
> news:BK************@newsfe7-gui.ntli.net...
>> 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
>>
>>
>
>



Nov 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: manohar.shankar | last post by:
Hi, I have been searching on this topic for quite sometime and didnt get any answer. Is there a way I can extend/add methods/properties to a C# class during runtime. eg., I have class:...
1
by: vijay | last post by:
Hello I am learnign Dot NEt I have implemted 1. remote object 2.Listener 3.Client Listener started and listening to requests Client started and able to nstantiate remote object But when a...
2
by: Fadi | last post by:
Backround: I am trying to figure out how to do the equivalant of a classic COM Local Server Singleton in .NET/C#. I created a coupld of simple Class Libs that exposes public interfaces and hosted...
3
by: MIGUEL | last post by:
Hi all, I'm quite lost with how adding web references to a project creates proxy classes. I've developed a web service with two classes inside and that contains three references to three...
2
by: deko | last post by:
When to use a privileged user thread rather than a windows service? That's the question raised in a previous post . It was suggested that if the service needs to interact with a WinForms app...
6
by: dotNeter | last post by:
The services, talked here, are things used in IServiceContainer, IServiceProvider, etc. In my opinion, everything can be a service, and a service is generally used for providing specific features...
5
by: Rakesh Rathod | last post by:
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...
0
by: =?Utf-8?B?QW5keSBZdQ==?= | last post by:
Hi, I'm trying to return exceptions from a WCF Service using FaultExceptions. I got the service compiled and running. But I get an error while adding a service reference to it. The error reads: "...
3
by: =?Utf-8?B?QWxleGFuZGVyIFd5a2Vs?= | last post by:
I recently raninto major problems when I added the Exception namespace to the Project which has my DBML file attached to it. Once I renamed all the Exceptions instances to Syste.Exception the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.