【问题标题】:SOAP using soap4r RubySOAP 使用 soap4r Ruby
【发布时间】:2013-08-08 21:52:18
【问题描述】:
I implemented a standalone server with the help of this tutorial:
http://www.tutorialspoint.com/ruby/ruby_web_services.htm

The code is :

require "soap/rpc/standaloneserver"

begin
   class MyServer < SOAP::RPC::StandaloneServer

      # Expose our services
      def initialize(*args)
        super(args[0], args[1], args[2], args[3])
         add_method(self, 'add', 'a', 'b')
         add_method(self, 'div', 'a', 'b')
      end

      # Handler methods
      def add(a, b)
         return a + b
      end
      def div(a, b)
         return a / b
      end
  end
  server = MyServer.new("soapservice", 'soapservice', 'localhost', 8080)

  trap('INT'){server.shutdown  }
  server.start
rescue => err
  puts err.message
end

当我尝试通过指向 localhost:8080 从浏览器访问它时,它给了我以下错误“[2013-08-08T16:31:19.040360 #4840] 错误 --soapservice: GET 请求不允许”。我尝试通过 POST 访问它,但仍然是同样的问题。谁能告诉我应该使用什么正确的 URL 来使用这个网络服务?

【问题讨论】:

    标签: ruby soap soap4r


    【解决方案1】:

    尝试将其添加到顶部

    require 'rubygems'
    #gem 'soap4r'
    gem 'soap4r-ruby1.9'
    require 'soap/rpc/standaloneServer'
    require 'builder'
    

    【讨论】:

      猜你喜欢
      • 2011-08-10
      • 2010-09-26
      • 1970-01-01
      • 1970-01-01
      • 2011-01-20
      • 1970-01-01
      • 2011-01-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多