在 Ruby 中使用 SOAP 的最佳方式是什么? [英] What's the best way to use SOAP with Ruby?

查看:35
本文介绍了在 Ruby 中使用 SOAP 的最佳方式是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的一个客户要求我将第 3 方 API 集成到他们的 Rails 应用中.唯一的问题是 API 使用 SOAP.Ruby 基本上已经放弃了 SOAP 以支持 REST.他们提供了一个 Java 适配器,显然可以与 Java-Ruby 桥一起使用,但如果可能,我们希望将其全部保留在 Ruby 中.我查看了soap4r,但它的名声似乎有点差.

A client of mine has asked me to integrate a 3rd party API into their Rails app. The only problem is that the API uses SOAP. Ruby has basically dropped SOAP in favor of REST. They provide a Java adapter that apparently works with the Java-Ruby bridge, but we'd like to keep it all in Ruby, if possible. I looked into soap4r, but it seems to have a slightly bad reputation.

那么将 SOAP 调用集成到 Rails 应用程序中的最佳方法是什么?

So what's the best way to integrate SOAP calls into a Rails app?

推荐答案

我们使用了内置的 soap/wsdlDriver 类,它实际上是 SOAP4R.这很慢,但非常简单.您从 gems/etc 获得的 SOAP4R 只是同一事物的更新版本.

We used the built in soap/wsdlDriver class, which is actually SOAP4R. It's dog slow, but really simple. The SOAP4R that you get from gems/etc is just an updated version of the same thing.

示例代码:

require 'soap/wsdlDriver'

client = SOAP::WSDLDriverFactory.new( 'http://example.com/service.wsdl' ).create_rpc_driver
result = client.doStuff();

就是这样

这篇关于在 Ruby 中使用 SOAP 的最佳方式是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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