Windows Vista Forums

calling different servers
  1. #1


    dshemesh Guest

    calling different servers

    Hello,
    I want to write a WCF client which each time calls a different url (or
    server). I know by sure that all the urls which will be called implement the
    same predefined wsdl (probably using WCF as well).
    I am new to WCF, so I tried going over the basics, and created a WCF server
    and client using the examples in msdn. Now, I want to change the auto
    generated client code (auto generated by svcutil.exe) so that I will be able
    to call each time a different URL and method (again, the list of possible
    methods are predefined by a wsdl created using a C# interface).

    Thank you!
    --
    dshemesh


      My System SpecsSystem Spec

  2. #2


    Arkady Frenkel Guest

    Re: calling different servers

    Just merge client code received from svcutil for different services
    Arkady

    "dshemesh" <dshemesh@discussions.microsoft.com> wrote in message
    news:34DBA49B-7CDE-46B6-ABFE-0963B4FB0F42@microsoft.com...
    > Hello,
    > I want to write a WCF client which each time calls a different url (or
    > server). I know by sure that all the urls which will be called implement
    > the
    > same predefined wsdl (probably using WCF as well).
    > I am new to WCF, so I tried going over the basics, and created a WCF
    > server
    > and client using the examples in msdn. Now, I want to change the auto
    > generated client code (auto generated by svcutil.exe) so that I will be
    > able
    > to call each time a different URL and method (again, the list of possible
    > methods are predefined by a wsdl created using a C# interface).
    >
    > Thank you!
    > --
    > dshemesh



      My System SpecsSystem Spec

  3. #3


    dshemesh Guest

    Re: calling different servers

    I don't really understand what this means.
    I do not know currently which urls I will call. They will be given to me
    when the program is already running.
    --
    dshemesh


    "Arkady Frenkel" wrote:

    > Just merge client code received from svcutil for different services
    > Arkady
    >
    > "dshemesh" <dshemesh@discussions.microsoft.com> wrote in message
    > news:34DBA49B-7CDE-46B6-ABFE-0963B4FB0F42@microsoft.com...
    > > Hello,
    > > I want to write a WCF client which each time calls a different url (or
    > > server). I know by sure that all the urls which will be called implement
    > > the
    > > same predefined wsdl (probably using WCF as well).
    > > I am new to WCF, so I tried going over the basics, and created a WCF
    > > server
    > > and client using the examples in msdn. Now, I want to change the auto
    > > generated client code (auto generated by svcutil.exe) so that I will be
    > > able
    > > to call each time a different URL and method (again, the list of possible
    > > methods are predefined by a wsdl created using a C# interface).
    > >
    > > Thank you!
    > > --
    > > dshemesh

    >
    >
    >

      My System SpecsSystem Spec

  4. #4


    Marc Gravell Guest

    Re: calling different servers

    You are you currently using your services? If you are using a
    ClientBase<T> derivative (where T is your service contract interface),
    then note that one of the ctor overloads accepts the remote address.

    I can't remember what svcutil spits out (for various reasons I use
    ClientBase<T> directly), but this might help?

    Marc


      My System SpecsSystem Spec

  5. #5


    dshemesh Guest

    Re: calling different servers

    I have the following ctors:
    public Service1Client()
    {
    }

    public Service1Client(string endpointConfigurationName) :
    base(endpointConfigurationName)
    {
    }

    public Service1Client(string endpointConfigurationName, string
    remoteAddress) :
    base(endpointConfigurationName, remoteAddress)
    {
    }

    public Service1Client(string endpointConfigurationName,
    System.ServiceModel.EndpointAddress remoteAddress) :
    base(endpointConfigurationName, remoteAddress)
    {
    }

    public Service1Client(System.ServiceModel.Channels.Binding binding,
    System.ServiceModel.EndpointAddress remoteAddress) :
    base(binding, remoteAddress)
    {
    }

    As you can see, none of them accepts only the remote address. I need to add
    a endpointConfigurationName or a Binding. I don't know which parameters I
    should give there because I don't know what's an endpointConfigurationName or
    how to create a Binding.
    --
    dshemesh


    "Marc Gravell" wrote:

    > You are you currently using your services? If you are using a
    > ClientBase<T> derivative (where T is your service contract interface),
    > then note that one of the ctor overloads accepts the remote address.
    >
    > I can't remember what svcutil spits out (for various reasons I use
    > ClientBase<T> directly), but this might help?
    >
    > Marc
    >
    >
    >

      My System SpecsSystem Spec

  6. #6


    dshemesh Guest

    Re: calling different servers

    And besides, I already have a remote address and binding defined in the
    config file. Wouldn't this be a problem when trying to give a different
    remote address?
    --
    dshemesh


    "Marc Gravell" wrote:

    > You are you currently using your services? If you are using a
    > ClientBase<T> derivative (where T is your service contract interface),
    > then note that one of the ctor overloads accepts the remote address.
    >
    > I can't remember what svcutil spits out (for various reasons I use
    > ClientBase<T> directly), but this might help?
    >
    > Marc
    >
    >
    >

      My System SpecsSystem Spec

  7. #7


    Marc Gravell Guest

    Re: calling different servers

    (string, string) is the one; have you tried "Default", the contract
    name, and or any other random strings from the config file?

    Don't have my code to hand, so can't check at mo - but will look
    tomorrow.

    Marc

      My System SpecsSystem Spec

  8. #8


    Marc Gravell Guest

    Re: calling different servers

    Aah... remembered how I did it... ask WCF itself ;-p - specifically,
    create an instance using the default ctor, and ask what end-point it
    is using. Subsequently, I can link to any address by using this name
    along with my bespoke URL.

    static SimpleClient() {
    try {
    DefaultBindingName = new SimpleClient<T>.Endpoint.Name;
    } catch {
    DefaultBindingName = "Default";
    }
    }

    Marc


      My System SpecsSystem Spec

  9. #9


    -=B3N=- Guest

    Re: calling different servers

    I too am having this problem. Anyone know?

    "dshemesh" wrote:

    > And besides, I already have a remote address and binding defined in the
    > config file. Wouldn't this be a problem when trying to give a different
    > remote address?
    > --
    > dshemesh
    >
    >
    > "Marc Gravell" wrote:
    >
    > > You are you currently using your services? If you are using a
    > > ClientBase<T> derivative (where T is your service contract interface),
    > > then note that one of the ctor overloads accepts the remote address.
    > >
    > > I can't remember what svcutil spits out (for various reasons I use
    > > ClientBase<T> directly), but this might help?
    > >
    > > Marc
    > >
    > >
    > >

      My System SpecsSystem Spec

  10. #10


    Marc Gravell Guest

    Re: calling different servers

    What have you tried? And are you using svcutil proxies or a custom
    ClientBase<T> subclass?
    You need to call the ctor that includes the remote address; I posted a
    way to obtain the default binding name (so that you can use the simple
    "string,string" ctor).

    ?

    Marc


      My System SpecsSystem Spec

Page 1 of 2 12 LastLast
calling different servers problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
no logon servers available when connecting to most servers in trus 2010 Server General 1 16 Oct 2009
mfc dll calling clr? dave .NET General 1 10 Jun 2009
cannot use parenthesis when calling sub techstress VB Script 2 07 May 2009
Calling ID Mary Anne Vista mail 3 09 Feb 2008
Sick of the name-calling Ron Vista General 17 09 Sep 2007