Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Indigo

Vista - calling different servers

 
 
Old 05-17-2007   #1 (permalink)
dshemesh


 
 

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
Old 05-17-2007   #2 (permalink)
Arkady Frenkel


 
 

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
Old 05-17-2007   #3 (permalink)
dshemesh


 
 

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
Old 05-17-2007   #4 (permalink)
Marc Gravell


 
 

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
Old 05-17-2007   #5 (permalink)
dshemesh


 
 

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
Old 05-17-2007   #6 (permalink)
dshemesh


 
 

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
Old 05-17-2007   #7 (permalink)
Marc Gravell


 
 

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
Old 05-21-2007   #8 (permalink)
Marc Gravell


 
 

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
Old 06-14-2007   #9 (permalink)
-=B3N=-


 
 

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
Old 06-14-2007   #10 (permalink)
Marc Gravell


 
 

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
 

Thread Tools


Similar Threads
Thread Forum
mfc dll calling clr? .NET General
cannot use parenthesis when calling sub VB Script
Calling ID Vista mail
Sick of the name-calling Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

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