RUBY 实现SOAP
来源:互联网 发布:影像系统制作软件 编辑:程序博客网 时间:2024/06/06 05:13
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)}"
- RUBY 实现SOAP
- Ruby中的SOAP编程
- 【soap】利用soap实现webservice
- Ruby以SOAP协议访问Webservice
- 【soap】SOAP扩展PHP轻松实现WebService
- 【soap】利用php的soap实现webservice
- 实现 SOAP 扩展
- cxf实现soap webservice
- SOAP头鉴权的实现
- VC++ 实现soap服务端
- iOS 实现SOAP协议
- php soap简单实现
- PHP SOAP实现WebService
- Java实现SOAP协议
- Java实现SOAP协议
- 用PHP实现Soap通讯
- 用php实现soap通讯
- VB实现Soap XML解析
- 黑客常见攻击手法和步骤
- python使用心得
- 数据库牛人的成长历程
- 我们必须要了解的网络安全常识
- 怎么在RAC环境里SHOW PARAMETER时候可以显示HIDDEN参数
- RUBY 实现SOAP
- WinXP八种安全模式揭密
- 字符串
- VC++实现 Win200 0下直接读写磁盘扇区
- VC下 头文件搜索路径文件.set的设置
- September, 3(R)
- 塞班S60V1(S60第一版)UCWEB 7.0下载
- Adventures in Luserland: Finding Disk Sectors Associated with File Records.
- c/c++ struct的大小以及sizeof用法