Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Things to consider while calling one WCF service from another

We are migrating set of WSE services to WCF platform.

The new WCF services are called over secured HTTP. (https)

I want to invoke an operation contract of one WCF service from another. Both the services are mostly hosted in the same IIS, but they can be on separate IIS server.

  1. Do I need to take care of some things (which i obviously do not know at present) in this scenario?
  2. Is there any special calling mechanism in this case?
  3. Does calling mechanism change when call is synchronous and when it is asynchronous?
  4. Can you suggest some type of binding which is readily available in this case?
like image 401
Learner Avatar asked Aug 02 '11 09:08

Learner


2 Answers

1.) If the services are on the same box, use named pipes, unless you have any compelling reason not to, to communicate with each other. While WCF proper doesn't care about what you're doing as long as the address, binding and contract all match up (see what I did there?), .NET will when it comes to making network connections. The fewer you use, the better. (see http://msdn.microsoft.com/en-us/library/fb6y0fyc.aspx for more details)

2.) As stated in #1, if they're talking on the same box, use named pipes unless there's a good reason not to.

3.) Can you provide a little more detail on what you mean by this or what you're planning on doing? A lot of this is built out for you, so assuming you're familiar with implementing async methods and using async callbacks, the short answer is yes, it's different than calling an operation synchronously, but that's to be expected. Or do you mean IsOneWay = true? If that's the case, the calling mechanism is the same but there can be a number of other gotchas (e.g. faults)

4.) Named Pipes on the same box, BasicHttp otherwise (unless you need any of the additional features from WS).

like image 123
dotnetnate Avatar answered Oct 19 '22 06:10

dotnetnate


but they can be on separate IIS server

In this case, you either can't use Windows authentication (if you were using it) or you have to set up some special delegates stuff on the domain to make it work. Windows Authentication won't "hop" between different servers. Here's some info on that, there's a lot of reading out there on the subject.

If they stay on the same server or you're not using Windows authentication, then it shouldn't be a problem.

Does calling mechanism change when call is synchronous and when it is asynchronous?

Shouldn't matter, it's all the same on the service end. I will say that if the client calls X and X calls Y, X might as well call Y synchronously because it can't return to the client until Y is done anyway. (If X calls Y and Z, then X making async calls may make more sense.)

Can you suggest some type of binding which is readily available in this case?

If you were using WSE before, then BasicHttpBinding is going to be the one closest to what you were doing and will look pretty familiar in what it outputs. It's also the simplest one to work with.

like image 29
Tridus Avatar answered Oct 19 '22 08:10

Tridus