webserivce reference without default url

Discussion in 'ASP .Net Web Services' started by Hans, Jan 27, 2004.

  1. Hans

    Hans Guest

    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
    Hans, Jan 27, 2004
    #1
    1. Advertising

  2. Hans

    Jan Tielens Guest

    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" <> wrote in message
    news:D...
    > 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
    Jan Tielens, Jan 27, 2004
    #2
    1. Advertising

  3. Hans

    Jan Tielens Guest

    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" <> schreef in bericht
    news:...
    > 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
    Jan Tielens, Jan 27, 2004
    #3
  4. Hans

    Hans Guest

    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
    Hans, Jan 28, 2004
    #4
  5. Hans

    Jan Tielens Guest

    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" <> wrote in message
    news:...
    > 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
    >
    Jan Tielens, Jan 29, 2004
    #5
  6. Hans

    Hans Guest

    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
    Hans, Jan 29, 2004
    #6
  7. Hans

    Jan Tielens Guest

    > 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" <> wrote in message
    news:...
    > 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
    >
    Jan Tielens, Jan 29, 2004
    #7
  8. Hans

    Hans Guest

    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
    Hans, Jan 29, 2004
    #8
  9. Hans

    Jan Tielens Guest

    > 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" <> wrote in message
    news:...
    > 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
    Jan Tielens, Jan 29, 2004
    #9
  10. Hans

    Hans Guest

    > 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
    Hans, Jan 29, 2004
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Farooq Khan
    Replies:
    3
    Views:
    396
    Simon Gorski
    Dec 22, 2003
  2. doron

    Exposing a webserivce (Biztalk)

    doron, Sep 1, 2005, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    98
    Michael Nemtsev
    Sep 2, 2005
  3. Replies:
    0
    Views:
    102
  4. Kjartan Furnes

    calling axis webserivce with credentials in header

    Kjartan Furnes, Jan 3, 2008, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    592
    Roman Gallauner
    Jan 26, 2008
  5. Raymond

    ASP connect to dot net SOAP webserivce

    Raymond, Dec 14, 2006, in forum: ASP General
    Replies:
    0
    Views:
    98
    Raymond
    Dec 14, 2006
Loading...

Share This Page