Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > webserivce reference without default url

Reply
Thread Tools

webserivce reference without default url

 
 
Hans
Guest
Posts: n/a
 
      01-27-2004
Hi

I add a webreference to a webservice. I set the URL Behavior to dynamic and set the url with the web.config
It works well

I check the reference.cs and there I have a default URL pointing to the URL I used to bind the webservice

Does anyone now how to have dynamic webreferences and avoiding the default url

Thanks in advance

/Hans
 
Reply With Quote
 
 
 
 
Jan Tielens
Guest
Posts: n/a
 
      01-27-2004
This is possible, but it involves some manual work. You must save the
generated wsdl file into a file on your hard disk. Then you have to edit the
xml: remove the <service> tag and it's contents. So far the wsdl, in your
VS.NET when you choose Add Web Reference, choose the altered wsdl file on
your harddisk instead of navigating to your webservice. Now the generated
proxy clients won't have the default url filled out.

--
Greetz

Jan Tielens
________________________________
Read my weblog: http://weblogs.asp.net/jan


"Hans" <(E-Mail Removed)> wrote in message
news(E-Mail Removed)...
> Hi,
>
> I add a webreference to a webservice. I set the URL Behavior to dynamic

and set the url with the web.config.
> It works well.
>
> I check the reference.cs and there I have a default URL pointing to the

URL I used to bind the webservice.
>
> Does anyone now how to have dynamic webreferences and avoiding the default

url?
>
> Thanks in advance.
>
> /Hans



 
Reply With Quote
 
 
 
 
Jan Tielens
Guest
Posts: n/a
 
      01-27-2004
You can use the URLBehavior property of the Web Reference: set this to
dynamic so the setting is stored in the app.config file. You can change this
file without having to rebuild the complete solution.

--
Greetz,
Jan
__________________________________
Read my weblog: http://weblogs.asp.net/jan
"Hans" <(E-Mail Removed)> schreef in bericht
news:(E-Mail Removed)...
> Thanks Jan.
>
> I will try that.
>
> But its strange. There are lots of webservices out there.
> Does all the developers build a extra time before production deployment,

just to bind to the production enviroment instead of the develop enviroment,
or do they do the manual thing, or pehaps they dont care?
> Because if the configuration setting fails you dont want to set the

connection string to the production test.
>
> And what about to edit the references.cs and the references.map?
>
> /Hans



 
Reply With Quote
 
Hans
Guest
Posts: n/a
 
      01-28-2004
Thanks Jan,

Sorry i might have expressed my self poorly...

I use the dynamic binding and set this in the web.config.
It works well.
But if i some how lose the url in the web.config I dont want the app reference the default url.

This is because last time I did build the app was for a production test enviroment and then it will move
to the production enviroment.
What if the people that does the move do not handle the web.config in correct way och destory det binding information.

If there are no binding information the webservice will go to the default url.
But this url is the production test with data that are bad and it is harder to detect this problem...

That way I wonder how everybody else does this. There must be a simple solution.

Or else I can naturaly fall back to you solution to remove the section part in wsdl.
But what if to edit the reference.cs or reference.map?

/Hans

 
Reply With Quote
 
Jan Tielens
Guest
Posts: n/a
 
      01-29-2004
You could check in code, when your application starts, if the key exists in
the app.config file. If not you can show a message telling the user his
configuration is screwed.

--
Greetz

Jan Tielens
________________________________
Read my weblog: http://weblogs.asp.net/jan


"Hans" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Thanks Jan,
>
> Sorry i might have expressed my self poorly...
>
> I use the dynamic binding and set this in the web.config.
> It works well.
> But if i some how lose the url in the web.config I dont want the app

reference the default url.
>
> This is because last time I did build the app was for a production test

enviroment and then it will move
> to the production enviroment.
> What if the people that does the move do not handle the web.config in

correct way och destory det binding information.
>
> If there are no binding information the webservice will go to the default

url.
> But this url is the production test with data that are bad and it is

harder to detect this problem...
>
> That way I wonder how everybody else does this. There must be a simple

solution.
>
> Or else I can naturaly fall back to you solution to remove the section

part in wsdl.
> But what if to edit the reference.cs or reference.map?
>
> /Hans
>



 
Reply With Quote
 
Hans
Guest
Posts: n/a
 
      01-29-2004
Thanks for your reply.

Of course I can do that.

I was just thinking since there are quite a lot webservices out there and many of them most have the same problem...

I'm probobly driving at: The .NET enviroment is missing someting her. It can be done, - but with a little manual work.
Why not a settning when creating the webservice proxy...


But what happend to the question about edit the reference.cs or reference.map compare to the wsdl file. Do you know?

/Hans

 
Reply With Quote
 
Jan Tielens
Guest
Posts: n/a
 
      01-29-2004
> But what happend to the question about edit the reference.cs or
reference.map compare to the wsdl file. Do you know?

Can you explain a little bit more... I don't understand your question.

--
Greetz

Jan Tielens
________________________________
Read my weblog: http://weblogs.asp.net/jan


"Hans" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Thanks for your reply.
>
> Of course I can do that.
>
> I was just thinking since there are quite a lot webservices out there and

many of them most have the same problem...
>
> I'm probobly driving at: The .NET enviroment is missing someting her. It

can be done, - but with a little manual work.
> Why not a settning when creating the webservice proxy...
>
>
> But what happend to the question about edit the reference.cs or

reference.map compare to the wsdl file. Do you know?
>
> /Hans
>



 
Reply With Quote
 
Hans
Guest
Posts: n/a
 
      01-29-2004
Sorr

If i open the reference.cs the default URL is hard coded in there
I was just thinking about removing that line or set it to blank., to solve my first question about the default url
Because your solution about the wsdl incorporated a lot of manual work.

Such as save the wsdl fil
remove the service sectio
change the binding name so it doesn't ends with Soa
go to the wsdl file insted
Reading the connection url from web.confi
set the url for the webservic

I was thinking: Way not just make the change in reference.cs?
Then I saw that in the reference.map there was a lot of references to
Can they be removed

And one more question
If i have a DISCO file, The one that is generated when creating the proxy
Whay not always use the discover method insted of setting the Url Behavior
The only change the disoc file instead of web.config ...

/Hans
 
Reply With Quote
 
Jan Tielens
Guest
Posts: n/a
 
      01-29-2004
> I was thinking: Way not just make the change in reference.cs??
> Then I saw that in the reference.map there was a lot of references to.
> Can they be removed?


The references are used when you choose "Update Web Reference", if you
remove the references, you won't be able to update the web reference.

Probably you know this, but it's possible to generate proxy classes using
the WSDL too (command line tool). By doing so, you won't have the
Reference.map and stuff like that in VS.NET, only the class for the
generated method.

> And one more question.
> If i have a DISCO file, The one that is generated when creating the proxy.
> Whay not always use the discover method insted of setting the Url

Behavior.
> The only change the disoc file instead of web.config ...

I pass on this one... Dino?

--
Greetz

Jan Tielens
________________________________
Read my weblog: http://weblogs.asp.net/jan


"Hans" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Sorry
>
> If i open the reference.cs the default URL is hard coded in there.
> I was just thinking about removing that line or set it to blank., to solve

my first question about the default url.
> Because your solution about the wsdl incorporated a lot of manual work.
>
> Such as save the wsdl file
> remove the service section
> change the binding name so it doesn't ends with Soap
> go to the wsdl file insted
> Reading the connection url from web.config
> set the url for the webservice
>
> I was thinking: Way not just make the change in reference.cs??
> Then I saw that in the reference.map there was a lot of references to.
> Can they be removed?
>
> And one more question.
> If i have a DISCO file, The one that is generated when creating the proxy.
> Whay not always use the discover method insted of setting the Url

Behavior.
> The only change the disoc file instead of web.config ...
>
>
> /Hans



 
Reply With Quote
 
Hans
Guest
Posts: n/a
 
      01-29-2004
> The references are used when you choose "Update Web Reference", if yo
> remove the references, you won't be able to update the web reference


I have webservice that returns a typed dataset. If I change the dataset for some reason I find that a update doesent do the job. I have to remove the reference and then add it again
And the webservice is still under development. (The client to
I know that interfaces must be decided early and then not be changed . But sometimes I do must change the interface
That way I was looking for an way round my original problem that does not include to much work

Anyway thanks alot for your help!!

/Han

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
calling axis webserivce with credentials in header Kjartan Furnes ASP .Net Web Services 1 01-26-2008 08:44 PM
How do i deploy a webservice in client machine which is referencing another webserivce on the server nageswari.k@gmail.com ASP .Net Web Services 0 01-11-2007 09:14 AM
ASP connect to dot net SOAP webserivce Raymond ASP General 0 12-14-2006 08:56 PM
Exposing a webserivce (Biztalk) doron ASP .Net Web Services 1 09-02-2005 08:17 AM
having multiple classes with WebMethods in single WebSerivce?? Farooq Khan ASP .Net Web Services 3 12-22-2003 04:39 PM



Advertisments