如何构建肥皂休息网关

发布于 2024-12-28 18:38:09 字数 149 浏览 0 评论 0原文

您将如何以最少的工作量构建一个肥皂休息网关?我在 Rails 3.2 服务器上提供了 REST API。我的客户要求我提供 SOAP API。我不想使用 Rails 来提供 SOAP API,因为这可能比使用完全支持 SOAP 的框架构建 SOAP 到 REST 网关需要更多的工作。

How would you build a soap to rest gateway with the least amount of work? I provide a REST API on my Rails 3.2 server. My customer requires me to provide a SOAP API. I don't want to use Rails for providing the SOAP API since that would probably take much more work than building a SOAP to REST gateway using a framework that fully supports SOAP.

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

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

发布评论

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

评论(2

天荒地未老 2025-01-04 18:38:09

我刚刚注意到 Rails 3.2 自动将 SOAP 请求解析为 params 哈希(ActionDispatch::ParamsParser Rack 中间件)。因此,我决定在 Rails 中实现网关。由于我并不真正关心实现功能齐全的 SOAP 服务器——我想要的只是让它适用于客户当前的 SOAP 客户端——我只需从 params 哈希中读取我需要的数据并构建 xml 响应使用 Builder 并发布静态 wsdl 文件(如果需要)。它将少于 20 行代码。

config/routes.rb

Gateway::Application.routes.draw do
  match "/clientx/echo" => "clientx#echo"
end

应用程序/控制器/clientx_controller.rb

class ClientxController < ApplicationController
  def echo
    # authenticate client
    # parse params
    # send and receive rest request
    # render response
  end
end

I just noticed that Rails 3.2 parses SOAP requests automatically into the params hash (ActionDispatch::ParamsParser Rack middleware). So, I decided to implement the gateway in Rails. Since I don't really care to implement a full featured SOAP Server--all I want is to make it work for my customer's current SOAP client--I will just read the data that I need from the params hash and build the xml response using Builder and publish a static wsdl file if they need it. It will be less than 20 lines of code.

config/routes.rb

Gateway::Application.routes.draw do
  match "/clientx/echo" => "clientx#echo"
end

app/controllers/clientx_controller.rb

class ClientxController < ApplicationController
  def echo
    # authenticate client
    # parse params
    # send and receive rest request
    # render response
  end
end
凶凌 2025-01-04 18:38:09

Mule ESB 怎么样?支持多种形式的输入和输出可能性。自己基于Mule实现了一个SOAP接收应用程序。

What about Mule ESB? Supports a various form of input and output possibilities. Implemented a SOAP-receiving application based on Mule myself.

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