Ruby以SOAP协议访问Webservice
1. 测试qq是否在线
require "soap/wsdlDriver" def get_qq_satus(qqcode) wsdl = "http://www.webxml.com.cn/webservices/qqOnlineWebService.asmx?wsdl" driver = SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver driver.wiredump_file_base = 'log_file'#记录在使用WebService接口时所有发出和收到的xml消息 ret = driver.qqCheckOnline(:qqCode=>qqcode)#访问webservice的函数 p ret p ret.qqCheckOnlineResult if ret.qqCheckOnlineResult == “Y” puts "#{qqcode} 用户在线" else puts "#{qqcode} 不用户在线" end end qqcode = "XXXXXXXX" get_qq_satus(qqcode)