dinamic reference to WS

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Javier

    #1

    dinamic reference to WS

    Hello:
    I want to create a class that i could use to call a web service without
    adding the web reference from Visual Studio. That's because the url to the
    ..asmx o wsdl document will be given by te user at runtime.
    How can i code this? Is it too complex?
    Any information, code snippets or links to howtos will be wellcome.
    Thanks.
    Bye.
  • Demetri

    #2
    RE: dinamic reference to WS

    It's simple.

    In the application that consumes the web service go ahead and make the web
    reference as usual. The difference is that you set the "URL Behavior"
    property to "Dynamic". Doing so within visual stuidio will automatically
    modify the proxy class and the web.config (app.config) file to have a key
    with the URL to the web service.

    The consumer would then just change the value of the key for the location of
    the web service to be loaded at runtime.

    --
    -Demetri


    "Javier" wrote:
    [color=blue]
    > Hello:
    > I want to create a class that i could use to call a web service without
    > adding the web reference from Visual Studio. That's because the url to the
    > .asmx o wsdl document will be given by te user at runtime.
    > How can i code this? Is it too complex?
    > Any information, code snippets or links to howtos will be wellcome.
    > Thanks.
    > Bye.[/color]

    Comment

    • Alexis

      #3
      RE: dinamic reference to WS

      Javier,
      You should have a url for a "developmen t" version of that web service. Said
      that
      , you can add the webreference to VisualStudio to that asmx and then at
      runtime change the url to the actual asmx.

      at runtime...
      dim mywebservice = New webreference.my webservice
      mywebservice.Ur l = "actualurl.asmx "

      Regards,
      Alexis

      "Javier" wrote:
      [color=blue]
      > Hello:
      > I want to create a class that i could use to call a web service without
      > adding the web reference from Visual Studio. That's because the url to the
      > .asmx o wsdl document will be given by te user at runtime.
      > How can i code this? Is it too complex?
      > Any information, code snippets or links to howtos will be wellcome.
      > Thanks.
      > Bye.[/color]

      Comment

      • Javier

        #4
        RE: dinamic reference to WS

        Hello:
        Thanks for te answer, but i have a doubt. When i want to call to one method
        of the service, the "developmen t" web service must have the same methods than
        the service that will be used at runtime, isn't it?
        What i want to say is that i can change the url only if the new url points
        to a service with the same interface, same methods and parameters for these
        methods but i can't use it to call different web services with differents
        method names and different parameters, isn't it?
        Thanks for the help.
        Bye.



        "Demetri" wrote:
        [color=blue]
        > It's simple.
        >
        > In the application that consumes the web service go ahead and make the web
        > reference as usual. The difference is that you set the "URL Behavior"
        > property to "Dynamic". Doing so within visual stuidio will automatically
        > modify the proxy class and the web.config (app.config) file to have a key
        > with the URL to the web service.
        >
        > The consumer would then just change the value of the key for the location of
        > the web service to be loaded at runtime.
        >
        > --
        > -Demetri
        >
        >
        > "Javier" wrote:
        >[color=green]
        > > Hello:
        > > I want to create a class that i could use to call a web service without
        > > adding the web reference from Visual Studio. That's because the url to the
        > > .asmx o wsdl document will be given by te user at runtime.
        > > How can i code this? Is it too complex?
        > > Any information, code snippets or links to howtos will be wellcome.
        > > Thanks.
        > > Bye.[/color][/color]

        Comment

        • Demetri

          #5
          RE: dinamic reference to WS

          The web service that is used must have the same methods that your proxy class
          has defined begin and end points to and those methods must have the same
          signature as your proxy class has defined them as. This means that the web
          service could have MORE methods than the proxy class has defined, which is
          fine.

          If you are worried about the signatures not being the same and can forsee
          that this could indeed be the case between your dev and prod environments
          then perhaps you should look into deprecation rather than changing the
          parameters for already established methods that are in dev and prod.

          Does that make sense?

          --
          -Demetri


          "Javier" wrote:
          [color=blue]
          > Hello:
          > Thanks for te answer, but i have a doubt. When i want to call to one method
          > of the service, the "developmen t" web service must have the same methods than
          > the service that will be used at runtime, isn't it?
          > What i want to say is that i can change the url only if the new url points
          > to a service with the same interface, same methods and parameters for these
          > methods but i can't use it to call different web services with differents
          > method names and different parameters, isn't it?
          > Thanks for the help.
          > Bye.
          >
          >
          >
          > "Demetri" wrote:
          >[color=green]
          > > It's simple.
          > >
          > > In the application that consumes the web service go ahead and make the web
          > > reference as usual. The difference is that you set the "URL Behavior"
          > > property to "Dynamic". Doing so within visual stuidio will automatically
          > > modify the proxy class and the web.config (app.config) file to have a key
          > > with the URL to the web service.
          > >
          > > The consumer would then just change the value of the key for the location of
          > > the web service to be loaded at runtime.
          > >
          > > --
          > > -Demetri
          > >
          > >
          > > "Javier" wrote:
          > >[color=darkred]
          > > > Hello:
          > > > I want to create a class that i could use to call a web service without
          > > > adding the web reference from Visual Studio. That's because the url to the
          > > > .asmx o wsdl document will be given by te user at runtime.
          > > > How can i code this? Is it too complex?
          > > > Any information, code snippets or links to howtos will be wellcome.
          > > > Thanks.
          > > > Bye.[/color][/color][/color]

          Comment

          • hB

            #6
            Re: dinamic reference to WS

            check uddi.
            goto uddi server, locate the websvc, get asmx...
            u can ask for whole interface WSDL of a webservice then.
            (u need and interface to call the runtime... identified web svc)(u cant
            then generate proxy class of course)

            ---
            hB

            Comment

            Working...