6

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?
Learner
  • 4,661
  • 9
  • 56
  • 102

3 Answers3

4

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).

dotnetnate
  • 769
  • 4
  • 11
  • +1 for your answer. Do you mean I need to add an endpoint in the `Web.Config` file? And use that endpoint from the code? How to go about it? I am quite new to WCF. – Learner Aug 02 '11 at 11:13
  • Well, if you don't have an endpoint, you're not going to be talking to your service :) So an endpoint is required, and yes, throw it in your web.config file. – dotnetnate Aug 02 '11 at 11:24
  • Oh. I meant Web.Config is the right file or some other config file can come into the picture. In case of proxy classes, we get `Url` property on the proxy class and we can point to specific service endpoint. However, how can I point to specific endpoint from other service since I dont have anything to which I can set the URL to endpoint. So I am missing something. I am reading book for it but it would be great if you could provide information. – Learner Aug 02 '11 at 11:41
1

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.

Tridus
  • 5,021
  • 1
  • 19
  • 19
0

There shouldn't be anything special needed just because a WCF service method calls another WCF service. A WCF service doesn't "care" what other application types are calling its methods so long as they use the correct service contract, data contract, endpoint, and binding settings.

Just make sure that both service methods return promptly, and don't cause execution to block for long periods of time.

Franchesca
  • 1,453
  • 17
  • 32