RUBY ʵÏÖSOAP
SOAP ·þÎñ¶Ë£º
#!/usr/local/bin/ruby
require 'soap/rpc/standaloneServer'
module MySOAP
class Timer
def now
Time.new.strftime("%Y-%m-%d %H:%M:%S")
end
end
class Add
def add(i, j)
return i.to_i + j.to_i
end
end
end
class TimeServer < SOAP::RPC::StandaloneServer
def on_init
time = MySOAP::Timer.new
add = MySOAP::Add.new
add_method(time,"now")
add_method(add,"add")
end
end
NS = 'http://localhost/soap'
port = 4000
svr = TimeServer.new('timer',NS,'0.0.0.0',port)
trap('INT') { svr.shutdown }
puts "My SOAP is starting... port:#{port} (Ctrl+c to quit)"
svr.start
puts "My SOAP is stop."
SOAP¿Í»§¶Ë£º
require 'soap/rpc/driver'
proxy = SOAP::RPC::Driver.new("http://localhost:4000","http://localhost/soap")
proxy.add_method('now')
proxy.add_method('add','i','j')
puts "Server time now is : #{proxy.now}"
puts "9 + 2000 = #{proxy.add(9,2000)}"
Ïà¹ØÎĵµ£º
ÏÂÎÄת×Ô£º
http://www.cnblogs.com/watir/archive/2009/04/25/1443440.html
rubyÎļþ´ÓÃüÁîÐÐÖнÓÊÕ²ÎÊý
ÔÚÃüÁîÐз½·¨Ö´ÐÐrubyÎļþʱ£¬ÐèÒª´ÓÃüÁîÐÐÖд«Èë²ÎÊý£¬¿ÉÒÔʹÓÃÈ«¾Ö±äÁ¿£ºARGV
ÈçÓÐruby Îļþtest.rb,ÄÚÈÝÈçÏ£º
1 def hello(a)
2 puts a
3 end
4
5 ......
¿ª·¢»·¾³
OS:WindowsXP
Ruby:Ruby1.8.7
Rails:Rails2.3.5
Mysql:Mysql5.0.9
IDE:Rubymine2.0.1
×¼±¸¹¤×÷£º
°²×°ÒÔÏÂgem°ü
gem install ruport
gem install ruport-util
gem install acts_as_reportable
±¾ÀýÉè¼ÆµÄ±¨±íϵͳ¹¤×÷ÔÀíÈçͼ£¨´¿Êô¸öÈËÀí½â£©£¬ÒÔProducts±íΪÀý£º
½ÓÏÂÀ´ÊµÏÖµÄÀý×Ó½«ÀûÓÃeval·½·¨ÊµÏ ......
ת×Ô http://zhujg.javaeye.com/blog/355040
Ê×ÏÈ °²×° cygwin
cygwin Òª°²×°µÄ²å¼þÊÇ
ĬÈϵÄ+ make + gcc + libiconv
+ openssl
cygwinÏÂÐèÒª±àÒëÔÎļþ
µ½ruby-lang(http://ruby-lang.org/)
ÏÂÔØruby-1.9.1-p0.tar.gz
tar xvf ruby-1.9.1-p0.tar.gz
cd
ruby-1.9.1-p0
./configure
make && make in ......
Installing Ruby from source is my preferred method, although in Ubuntu Feisty you can supposedly install it with apt-get install ruby
now. Here’s the essential packages needed to get a source build working right though and the process I just went through:
sudo apt-get install build-essentia ......
1£® °²×°Cygwin
ÔËÐÐCygwinµÄ°²×°³ÌÐò¡£´ÓÎļû°üµÄµÄÁбíÖУ¬ÔÚDEVÀïÃ棬ȷ¶¨ÒªÑ¡Ôñ
• Ruby
• gcc
• subversion
ÄãÐèҪʹÓÃgccÀ´½¨Á¢Cygwin°æ±¾µÄMySQL.
2. ÔÚwindowsÉÏÃæ°²×°MYSQL£º
download MySQL 5.0 Windows Installer
3£® & ......