How can I generate some code in the proxy code?

  • Thread starter Thread starter Shi Jin
  • Start date Start date
S

Shi Jin

Hi there,

I am very new to C# and dot net. I am currently working on a web
service and a client. Now I need to change the default class
construction in the proxy code from

this.Url = "some http url"

to some code of my own, such as reading from a database, etc.
What I am doing is get the proxy code by wsdl and then edit it.

But everytime I changed my server code, especially the interface, I
need to get the new proxy code with wsdl, which overwrites my changes
to the proxy code. I need to make the same changes again.

Is there any way that I can put some code in the server code, so that
whenever swdl downloads the proxy code, my code is already there?

Thank you very much.
Shi
 
If all you are doing is overwriting the URL property, then your problem can
be solved in three ways.

a) this is a public property. Overwrite it in the calling class.
MyService myserv = new MyService();
myserv.Url = Mylib.GetConfig("/webservicelocation/myservice");

b) set the URL Behavior of the web service Dynamic (on the client side)
which means that the generated class will automatically look in the config
file for the URL setting.

c) use a parameter of the WSDL.EXE executable (which generates your proxy
class) to specify the URL that the class should use.

This is kindof a fun posting... the blogger posted the first solution, and
got feedback about the other two. :-)
http://dotnetjunkies.com/WebLog/jpalermo/archive/2004/12/01/34485.aspx

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

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.
 
Back
Top