rails 中 soap web service
时间:2010-11-18 来源:ydhydh
rails版本 2.2.2
1. gem sources -a http://gems.github.com/ 2. gem install datanoise-actionwebservice -v 2.2.2 3. 将下一行加在 config/environtment.rb Rails::Initializer.run do |config| do end 中 config.gem 'datanoise-actionwebservice', :lib => 'actionwebservice', :version => '2.2.2' 4. ruby script/generate web_service hello 5. services\hello_api.rb class HelloApi < ActionWebService::API::Base api_method :hello_message, :expects => [{:firstname=>:string}, {:lastname=>:string}], :returns => [:string] end 6.controller\hello_controller.rb class HelloController < ApplicationController wsdl_service_name 'Hello' #辅助方法 web_service_scaffold :invoke def hello_message(firstname, lastname) return "nihao #{firstname}, #{lastname}" end end 7. 调用 localhost:3000/hello/wsdl localhost:3000/hello/invoke
相关阅读 更多 +
排行榜 更多 +