浏览 2333 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2010-03-12
require "xmlrpc/client" class SoapController < ApplicationController before_filter :get_XMLRPC_server def index @products_arr = get_products() end def rcp @result_1= @server.call("Bugzilla.version") @result_2= @server.call("Bugzilla.timezone") @result_3= @server.call("Bug.get",{:ids=>[1]}) render :action=>'index' end def new_bug @product_name = params[:product_name] end def create_bug bug = { :product => params[:p], :component => params[:component], :summary => params[:summary], :version => 'unspecified', :description => params[:description], :op_sys => params[:op_sys], :platform => params[:platform], :priority => params[:priority], :severity => params[:severity] } @server.call("Bug.create",bug) redirect_to :action=>'index' end private def login_bugzilla(name,pass,is_remember) loginInfo= { :login=>name, :password => pass, :remember => is_remember } return @server.call("User.login",loginInfo) end def get_XMLRPC_server @server = XMLRPC::Client.new( "192.168.1.37", "/bugzilla/xmlrpc.cgi") login_bugzilla('test1@a.com','111111',false) end def get_products ids = @server.call('Product.get_selectable_products') p = @server.call('Product.get',ids) return p["products"] end end 这里我用的是Bugzilla的webservice 做例子 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |