WF4 / WCF 中的 RESTful 工作流服务端点

发布于 2024-09-18 01:14:23 字数 399 浏览 9 评论 0原文

各位, 我正在构建一个非常标准的工作流程,我希望通过 WCF 端点公开该工作流程 - 我正在使用“WCF 服务应用程序”项目模板,并且我有一个 .xamlx 服务。这是一个非常简单的文档交换工作流服务 - 我希望消费者向我 POST 一个 XML 块作为 HTTP 帖子的正文(HTTP 标头包含身份验证令牌)。作为响应,这些消费者将获得包含回复的 XML 块。我在这里使用 REST/POX 的 2 个目标是交互的基于文档/消息的性质,并且我希望使非 .NET 环境(尤其是 Silverlight 和 iPhone 等有限环境)的客户端开发变得容易。

我真的不知道如何使用开箱即用的功能来实现这一点(除非我错过了一些东西)。有谁知道如何为 WF4 服务托管工作流程创建 RESTful(甚至是 REST-ish,我不挑剔)端点?任何引导正确方向的信息都会很棒。

Folks,
I'm building a pretty standard workflow that I want exposed via a WCF endpoint - I'm using the "WCF Service Application" project template and I've got a .xamlx service. This is a very simple document interchange workflow service - I want consumers to POST me a blob of XML as the body of an HTTP post (with HTTP headers containing authentication tokens). In response, these consumers will get a blob of XML containing the reply. 2 goals for me using REST/POX here are the document/message-based nature of the interaction AND I want to make client development easy for non-.NET environments (especially limited environments like Silverlight and iPhone).

I don't really see how to make this possible using out of the box features (unless I'm missing something). Does anybody know how to create a RESTful (or even REST-ish, I'm not picky) endpoint for a WF4 service-hosted workflow? Any info leading in the right direction here would be great.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

稀香 2024-09-25 01:14:23

CodePlex 上有一个未发布的项目来介绍这一点,其中包括源代码。另请参阅这个答案,其中包含实现此目的的另一个想法。

如果您希望看到 CodePlex 活动的发布,请投票 UserVoice 请求

使用 REST 直通服务

正如 @Maurice 提到的,您还可以将 WF 服务视为后端服务,并公开仅调用 WF 服务的 REST 服务。

这种方法有点笨拙,但优点是它不使用任何未发布的或非常复杂的东西。

如果后端服务与 REST 服务在同一台计算机上运行(您可能会这样做),则应使用命名管道绑定公开 WF 服务。此绑定很快,但仅当调用者和被调用者位于同一机器上时才有效。

进一步思考:当调用后端服务时,您的 REST 直通服务被阻止。如果您的 WF 服务不是很快,您可以通过使用 REST 服务异步,因此在调用 WF 服务时不会阻塞线程池线程。

There is an unreleased item on CodePlex to cover this, which includes source code. Also see this SO answer which contains another idea for achieving this.

If you'd like to see the CodePlex activity released, please up-vote the UserVoice request.

Using a REST Pass-Through Service

As @Maurice mentions, you can also treat the WF service as a back-end service and expose a REST service that simply calls through to the WF service.

This method is a bit clumsy, but has the advantage that it doesn't use anything unreleased or really complicated.

If the back-end service runs on the same machine as the REST service (which is probably what you'd do), you should expose the WF service using the named pipes binding. This binding is fast, but only works when the caller and callee are on the same box.

A further thought: your REST pass-through service is blocked while the back-end service is being called. If your WF service is not very fast, you'd benefit from making your REST service asynchronous so it doesn't block a thread pool thread while the WF service is being called.

暮凉 2024-09-25 01:14:23

没有开箱即用的活动允许您将 REST 与 WF 结合使用,Receice 是纯 SOAP。

您可以构建自定义 REST 接收活动并将其用于您的工作流程。根据您的需求,这将是相当少量的工作。简单的选择是使用标准 REST WCF 端点并将 REST 数据转换为 SOAP,将请求传递到工作流,并对结果消息执行相反的操作。

There are no out of the box activities that will allow you to use REST with WF, the Receice is pure SOAP.

You can either build a custom REST Receive activity and use that with your workflow. Depending on your needs this is going to be quite a handful to a lot of work. The easy option is use use a standard REST WCF endpoint and convert the REST data to SOAP, pass rhe request on to the workflow, and do the reverse on the result message.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文