dynamic creation of web service proxy...

O

Ollie Riches

I know this has probably been asked a lot but I can't find any good exmaples
so....

Can anyone give some url's to C# code that dynaimcally generates a web
service proxy at runtime?

Cheers

Ollie Riches
http://www.phoneanalyser.net


Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a programmer
helping programmers.
 
N

Nicholas Paldino [.NET/C# MVP]

Ollie,

You will want to use the SoapHttpClientProtocol class. It will allow
you to make late-bound calls to SOAP services. As a matter of fact, when
you create proxies in VS.NET, the classes derive from this, and all method
calls actually package up calls to the Invoke method on the same class.

Hope this helps.
 
O

Ollie Riches

'Still the fast answer in the west' :)

Thanks

Ollie

Nicholas Paldino said:
Ollie,

You will want to use the SoapHttpClientProtocol class. It will allow
you to make late-bound calls to SOAP services. As a matter of fact, when
you create proxies in VS.NET, the classes derive from this, and all method
calls actually package up calls to the Invoke method on the same class.

Hope this helps.

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

Ollie Riches said:
I know this has probably been asked a lot but I can't find any good
exmaples so....

Can anyone give some url's to C# code that dynaimcally generates a web
service proxy at runtime?

Cheers

Ollie Riches
http://www.phoneanalyser.net


Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer
helping programmers.
 
N

Nicholas Paldino [.NET/C# MVP]

Ollie,

I'm actually in NYC, so from a local perspective, I'm in the east...


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

Ollie Riches said:
'Still the fast answer in the west' :)

Thanks

Ollie

Nicholas Paldino said:
Ollie,

You will want to use the SoapHttpClientProtocol class. It will allow
you to make late-bound calls to SOAP services. As a matter of fact, when
you create proxies in VS.NET, the classes derive from this, and all
method calls actually package up calls to the Invoke method on the same
class.

Hope this helps.

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

Ollie Riches said:
I know this has probably been asked a lot but I can't find any good
exmaples so....

Can anyone give some url's to C# code that dynaimcally generates a web
service proxy at runtime?

Cheers

Ollie Riches
http://www.phoneanalyser.net


Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer
helping programmers.
 
O

Ollie Riches

that's west of here :)

Ollie

Nicholas Paldino said:
Ollie,

I'm actually in NYC, so from a local perspective, I'm in the east...


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

Ollie Riches said:
'Still the fast answer in the west' :)

Thanks

Ollie

Nicholas Paldino said:
Ollie,

You will want to use the SoapHttpClientProtocol class. It will allow
you to make late-bound calls to SOAP services. As a matter of fact,
when you create proxies in VS.NET, the classes derive from this, and all
method calls actually package up calls to the Invoke method on the same
class.

Hope this helps.

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

I know this has probably been asked a lot but I can't find any good
exmaples so....

Can anyone give some url's to C# code that dynaimcally generates a web
service proxy at runtime?

Cheers

Ollie Riches
http://www.phoneanalyser.net


Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer
helping programmers.
 
N

Nicholas Paldino [.NET/C# MVP]

Yes, but since the planet is round, doesn't that mean that if you go far
enough west, you will eventually be east (and vice versa)?
Ollie Riches said:
that's west of here :)

Ollie

Nicholas Paldino said:
Ollie,

I'm actually in NYC, so from a local perspective, I'm in the east...


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

Ollie Riches said:
'Still the fast answer in the west' :)

Thanks

Ollie

in message Ollie,

You will want to use the SoapHttpClientProtocol class. It will
allow you to make late-bound calls to SOAP services. As a matter of
fact, when you create proxies in VS.NET, the classes derive from this,
and all method calls actually package up calls to the Invoke method on
the same class.

Hope this helps.

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

I know this has probably been asked a lot but I can't find any good
exmaples so....

Can anyone give some url's to C# code that dynaimcally generates a web
service proxy at runtime?

Cheers

Ollie Riches
http://www.phoneanalyser.net


Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer
helping programmers.
 
P

phancey

www.thinktecture.com has some code that does this though it needs
amending for reference and out parameters. Also I am having problems
with it working when anonymous access is turned off.

if you figure out how to set credentials on this dynamically created
proxy, let me know
 
G

Guest

Ollie,
Been down that road :( Unfortunately, there's not many googlets out there
with help on this and related topics. Here is some (modified) code I wrote to
do this. I also included a few other useful lines which set credentials,
timeouts, and connection limits. I hope it helps.

John

public ServiceInit()
{


MyService WebService = new MyService();

RegistryKey hklm = Registry.LocalMachine;
RegistryKey hkNterWeb = hklm.OpenSubKey(@"SOFTWARE\MyApp\WebService");
RegistryKey hkConfiguration = hkNterWeb.OpenSubKey(@"Configuration");

WebService.Url = (String) hkConfiguration.GetValue("WebServiceURL");
ServiceTimeout = int.Parse((String)
hkConfiguration.GetValue("WebServiceTimeout"));
ServiceConnections = int.Parse((String)
hkConfiguration.GetValue("WebServiceConnections"));
hklm.Close();

WebService.Credentials = System.Net.CredentialCache.DefaultCredentials;
WebService.Timeout = ServiceTimeout;

HttpWebResponse res = null;
HttpWebRequest req = (HttpWebRequest)WebRequest.Create (WebService.Url);
res = (HttpWebResponse)req.GetResponse ();
ServicePoint currentServicePoint = req.ServicePoint;
currentServicePoint.MaxIdleTime = ServiceTimeout;
currentServicePoint.ConnectionLimit = ServiceConnections;

}
 

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

Top