如何设计和实现一个简单的WCF服务中继? [英] How to design and implement a simple WCF service relay?

查看:88
本文介绍了如何设计和实现一个简单的WCF服务中继?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在设计使用WCF的实施框架一个简单的面向服务架构的过程。有迹象表明,一些应用程序使用服务的屈指可数。这些服务大多是内部使用,所以一个基本的身份验证和授权方案(如基于Windows的)就够了。

We are in the process of designing a simple service-oriented architecture using WCF as the implementation framework. There are a handful of services that a few applications use. These services are mostly used internally, so a basic authentication and authorization scheme (such as Windows-based) is enough.

我们想要的,但是,暴露了一些服务的一些商业伙伴。该组服务,他们有机会获得赖以生存的合同。一个标准的架构种类。

We want, however, expose some of the services to some business partners. The set of services they have access to depend on the contract. Kind of a standard architecture.

我认为我们可以实现的服务网关的用于认证请求,并将其转发到正确的内​​部服务端点(这类似于简单的ESB),这样我们就可以集中认证/授权code并揭露一个单一的端点到世界各地。我看了一些可用的工具包ESB,但他们似乎途径为此过于复杂。我们并不需要整合许多不同的服务,但只是其中的一些暴露在Internet上。

I think we can implement a service gateway which authenticates the requests and relays them to the correct internal service endpoint (this resembles simple ESB), so we can centralize the authentication/authorization code and expose one single endpoint to the world. I looked at some available ESB toolkits, but they seem way too complex for this purpose. We do not need to integrate a lot of different services, but just to expose some of them to the Internet.

如何设计和WCF实现这样一个中继器/路由器,保持它很简单?我已阅读深入了解Windows Communication Foundation的,这是一本好书,但我还是不够自信如何开始。

How can I design and implement such a relay/router in WCF, keeping it very simple? I have read Inside Windows Communication Foundation, which is a good book, but I'm still not confident enough on how to begin.

推荐答案

我已经做了非常类似的措施。你可以做的是暴露一个端点与一个单一的操作。

I have done something very similar to this. What you can do is expose an endpoint with a single operation.

这操作会看起来像

[OperationContract(Namespace="www.fu.com", Action="*")]
void CallThis(Message msg);

你的客户使用,旨在为他们打算呼吁他们想要的操作的服务的代理。然后让他们更改配置为指向端点/服务。在CallThis的方法将接受任何操作,而不管其签名。消息参数是WCF的消息。

Have your clients use a proxy that is intended for the service they intended to calling the operation they want. Then have them change the configuration to point to your endpoint/service. The "CallThis" method will accept any operation, regardless of its signature. The Message parameter is the WCF Message.

你需要做的,确定的东西应该去的地方,但你需要改变到去你的内部端点。

Do what you need to do to determine where things are supposed to go, but you will need to change the "To" to go to your internal endpoint.

我其实有一个全面落实这一点,所以如果你有问题,让我知道。

I actually have a full implementation of this, so if you have questions, let me know.

乔。

这篇关于如何设计和实现一个简单的WCF服务中继?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆