Ask a Question related to ASP.NET Web Services, Design and Development.

  1. #1

    Default Web References

    hi,
    There are 10 machines which run the same webservice. I have 10
    webreferences in my client. Only during runtime, will i decide which
    webservice to call.

    I dont want to have a swich case statement and handle the 10
    situations separately. Is it possible to create objects of the
    webreferences dynamically.

    I have created 10 objects and put it in an Arraylist. But i dont
    know how to call the Webmethod, by getting the object from the
    ArrayList. can anyone solve my problem?

    Thanks
    sendhil
    sendhil Guest

  2. Similar Questions and Discussions

    1. Getting references
      How does one get a reference to a previously created object? Here's the scenario. I'm writing a web application, so there's a listener object...
    2. [PHP-DEV] References
      The current support for references is mediocre at best. For instance: class foobar { var $variable; function foobar() { $variable =...
    3. ASP.net using UNC references and IIS 5.0
      I am having trouble getting ANY asp.net application (either .aspx or .asmx) working when IIS is configured to use a "share located on another...
    4. references help
      Hi, I need some desperate help with my references usage in the code below. I'd appreciate the help enormously. Following is the input in the...
    5. references
      Ok lets see I have the following two functions one calls the other Function a (&$myref) { ...something... then calls function b b($myref); ...
  3. #2

    Default Re: Web References

    Hi sendhil!

    If understand you right you have 10 times the same webservice!
    So first of all you can say - you have 1 webservice with 10 different URLs!?

    If that is right - you just have to add one refference - and 9 "extra urls"
    (or better 10 urls).

    So make an array (of strings) with that 10 URLs.
    Then call your WS with a 2 lines instead of 1 line

    theSvcRef.Url=stringArr[numberYouChose];
    theSvcRef.TheMethod();

    or if you (why ever) have to call all of them and dont want two lines of
    code do:
    object [] arrSvcs=new object[10];
    arrSvcs[0]=new TheSvcNS.SevName();
    ((TheSvcNS.SevName)arrSvc[0]).Url=strURL1;
    arrSvcs[1]=new TheSvcNS.SevName();
    ((TheSvcNS.SevName)arrSvc[1]).Url=strURL2;
    arrSvcs[2]=new TheSvcNS.SevName();
    ((TheSvcNS.SevName)arrSvc[3]).Url=strURL3;

    and later call it (for an example in a lopp):
    for(int nInd=0;nInd<10;nInd++) {
    ((TheSvcNS.SevName)arrSvc[0]).TheMethod();
    }

    HTH

    Manfred



    "sendhil" <report_1979@yahoo.com> schrieb im Newsbeitrag
    news:97ce4388.0311271457.5eb69ca5@posting.google.c om...
    > hi,
    > There are 10 machines which run the same webservice. I have 10
    > webreferences in my client. Only during runtime, will i decide which
    > webservice to call.
    >
    > I dont want to have a swich case statement and handle the 10
    > situations separately. Is it possible to create objects of the
    > webreferences dynamically.
    >
    > I have created 10 objects and put it in an Arraylist. But i dont
    > know how to call the Webmethod, by getting the object from the
    > ArrayList. can anyone solve my problem?
    >
    > Thanks
    > sendhil

    Manni Guest

  4. #3

    Default Re: Web References

    hi Manfred,
    Iam calling the same WebService 10 times. But they are in 10
    different machines. so i will have 10 different Webreferences ..right.
    so i can't just change the URL every time with one Webreference.

    Thanks
    sendhil

    "Manni" <pcpohler@hotmail.com> wrote in message news:<#54hY1TtDHA.2456@TK2MSFTNGP12.phx.gbl>...
    > Hi sendhil!
    >
    > If understand you right you have 10 times the same webservice!
    > So first of all you can say - you have 1 webservice with 10 different URLs!?
    >
    > If that is right - you just have to add one refference - and 9 "extra urls"
    > (or better 10 urls).
    >
    > So make an array (of strings) with that 10 URLs.
    > Then call your WS with a 2 lines instead of 1 line
    >
    > theSvcRef.Url=stringArr[numberYouChose];
    > theSvcRef.TheMethod();
    >
    > or if you (why ever) have to call all of them and dont want two lines of
    > code do:
    > object [] arrSvcs=new object[10];
    > arrSvcs[0]=new TheSvcNS.SevName();
    > ((TheSvcNS.SevName)arrSvc[0]).Url=strURL1;
    > arrSvcs[1]=new TheSvcNS.SevName();
    > ((TheSvcNS.SevName)arrSvc[1]).Url=strURL2;
    > arrSvcs[2]=new TheSvcNS.SevName();
    > ((TheSvcNS.SevName)arrSvc[3]).Url=strURL3;
    >
    > and later call it (for an example in a lopp):
    > for(int nInd=0;nInd<10;nInd++) {
    > ((TheSvcNS.SevName)arrSvc[0]).TheMethod();
    > }
    >
    > HTH
    >
    > Manfred
    >
    >
    sendhil Guest

  5. #4

    Default Re: Web References

    Sorry but I don't understand why you need 10 References!!!
    Maybe I misunderstood something, but you say it is the same Webservice.
    Wich means for me, it has the same functions!

    If it is like this - I have only the need for one reference!
    Or let's better say I have the need for one "proxy".

    And one time this WS runs on [url]http://mymachine1.dom.com/TheSvc/Svc.asmx[/url]
    and the other time it runs on
    [url]http://othermachine2.otherdom.net/OtherPath/othername.asmx[/url]

    If it is like this - there is no need for 10 refs!!

    My approach will work in this case!!

    We for an example have an application, where every customer owns it's own
    database.
    This DB is accessed via webservices. This WS can run on our server, or on an
    extra
    server for the customer.
    In simple words - if the customer is small - his DB (and WS) will run on
    one of our servers.
    If the customer is big, he owns his web- an dbserver.

    First of all - the application calls a central server, does authentication
    and as a result it gets the
    URL of the customers server. The next call goes to this server. Wich it is
    will be figured out at
    runtime - AND we have only one reference per WS we use!!
    So ONE ref 20 and more servers!

    Manfred

    "sendhil" <report_1979@yahoo.com> schrieb im Newsbeitrag
    news:97ce4388.0311281332.54c0884f@posting.google.c om...
    > hi Manfred,
    > Iam calling the same WebService 10 times. But they are in 10
    > different machines. so i will have 10 different Webreferences ..right.
    > so i can't just change the URL every time with one Webreference.
    >
    > Thanks
    > sendhil
    >
    > "Manni" <pcpohler@hotmail.com> wrote in message
    news:<#54hY1TtDHA.2456@TK2MSFTNGP12.phx.gbl>...
    > > Hi sendhil!
    > >
    > > If understand you right you have 10 times the same webservice!
    > > So first of all you can say - you have 1 webservice with 10 different
    URLs!?
    > >
    > > If that is right - you just have to add one refference - and 9 "extra
    urls"
    > > (or better 10 urls).
    > >
    > > So make an array (of strings) with that 10 URLs.
    > > Then call your WS with a 2 lines instead of 1 line
    > >
    > > theSvcRef.Url=stringArr[numberYouChose];
    > > theSvcRef.TheMethod();
    > >
    > > or if you (why ever) have to call all of them and dont want two lines of
    > > code do:
    > > object [] arrSvcs=new object[10];
    > > arrSvcs[0]=new TheSvcNS.SevName();
    > > ((TheSvcNS.SevName)arrSvc[0]).Url=strURL1;
    > > arrSvcs[1]=new TheSvcNS.SevName();
    > > ((TheSvcNS.SevName)arrSvc[1]).Url=strURL2;
    > > arrSvcs[2]=new TheSvcNS.SevName();
    > > ((TheSvcNS.SevName)arrSvc[3]).Url=strURL3;
    > >
    > > and later call it (for an example in a lopp):
    > > for(int nInd=0;nInd<10;nInd++) {
    > > ((TheSvcNS.SevName)arrSvc[0]).TheMethod();
    > > }
    > >
    > > HTH
    > >
    > > Manfred
    > >
    > >

    Manni Guest

  6. #5

    Default Web references

    Hi.

    I wrote two simple web services to start learning about them. When I
    called the two web services from an asp.net client, the Add Web
    Reference dialog created two entries in my project, localhost and
    localhost1. How can I add the two web services inside localhost for
    example? Why .NET defines one entry for each web service by default?

    Regards,
    Chris Leffer



    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Chris Leffer Guest

  7. #6

    Default Re: Web references

    You must name each Webreference, you can do this in the dialog window when
    you add the webrefence, or from the Solution Explorer window (rename the
    Webservice node). You cannot name 2 webservices with the same name because
    their name will reflect to the namespace the will be in.

    --
    Greetz,
    Jan
    __________________________________
    Read my weblog: [url]http://weblogs.asp.net/jan[/url]
    "Chris Leffer" <chrisl@wank.com> schreef in bericht
    news:eCRxax%23vDHA.2540@TK2MSFTNGP10.phx.gbl...
    > Hi.
    >
    > I wrote two simple web services to start learning about them. When I
    > called the two web services from an asp.net client, the Add Web
    > Reference dialog created two entries in my project, localhost and
    > localhost1. How can I add the two web services inside localhost for
    > example? Why .NET defines one entry for each web service by default?
    >
    > Regards,
    > Chris Leffer
    >
    >
    >
    > *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    > Don't just participate in USENET...get rewarded for it!

    Jan Tielens Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139