我正在学习Web服务API,所以我在我的rails应用程序上使用Savon for SOAP。我似乎无法做一个简单的操作,因为从提供者那里获取语言列表。我做错了什么?
以下是SOAP请求GetLanguages
的链接以下是关于irb的代码:
2.1.2 :001 > require 'savon'
=> true
2.1.2 :002 > soap_wsdl = "https://www.betamobi.tym2sell.co.bw/service/portalservice.asmx"
=> "https://www.betamobi.tym2sell.co.bw/service/portalservice.asmx"
2.1.2 :003 > client = Savon.client(wsdl: soap_wsdl)
2.1.2 :004 > response = client.call(:get_languages)
Savon::UnknownOperationError: Unable to find SOAP operation: :get_languages
Operations provided by your service: []
from /home/sifiso/.rvm/gems/ruby-2.1.2/gems/savon-2.11.1/lib/savon/operation.rb:23:in `ensure_exists!'
from /home/sifiso/.rvm/gems/ruby-2.1.2/gems/savon-2.11.1/lib/savon/operation.rb:15:in `create'
from /home/sifiso/.rvm/gems/ruby-2.1.2/gems/savon-2.11.1/lib/savon/client.rb:32:in `operation'
from /home/sifiso/.rvm/gems/ruby-2.1.2/gems/savon-2.11.1/lib/savon/client.rb:36:in `call'
from (irb):99
from /home/sifiso/.rvm/rubies/ruby-2.1.2/bin/irb:11:in `<main>'
Savon版本为2.11.1,Rails版本为4.2.6
答案 0 :(得分:3)
我终于明白了。以下是:
soap_wsdl = "https://www.betamobi.tym2sell.co.bw/service/portalservice.asmx"
应该是:
soap_wsdl = "https://www.betamobi.tym2sell.co.bw/service/portalservice.asmx?wsdl"