File: submit.rb

package info (click to toggle)
ruby-soap4r 2.0.5-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,032 kB
  • sloc: ruby: 52,729; xml: 266; sh: 42; javascript: 20; makefile: 13; perl: 10
file content (63 lines) | stat: -rw-r--r-- 2,257 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
require 'soap/wsdlDriver'
wsdl = 'http://cvs.sourceforge.jp/cgi-bin/viewcvs.cgi/*checkout*/rnn/rnn/app/rnn-hash.wsdl'
rnn = SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
rnn.generate_explicit_type = true
rnn.wiredump_dev = STDOUT

topic_map = {}
rnn.topics.each do |topic|
  topic_id = topic['topic_id']
  topic['children'] = {}
  topic_map[topic_id] = topic
end

topic_tree = {}
topic_map.each do |id, topic|
  topic_pid = topic['topic_pid']
  topic_title = topic['topic_title']
  if topic_pid.zero?
    topic_tree[topic_title] = topic
  else
    topic_map[topic_pid]['children'][topic_title] = topic
  end
end

topic_id = topic_tree['饤֥']['children']['XML']['topic_id']

title = "soap4r/1.4.8.1꡼줿"
text =<<'__EOS__'
soap4r/1.4.8.1꡼줿

1.4.7ѹϰʲ̤ꡣ
* Ruby/1.8ѻȯwarningФʤ褦ˤޤ
* WSDLɤߡ饤Ȥñ˥᥽åɤƤӽФ褦ˤ
  wsdlDriverɲäޤGoogle򸡺륵ץ롣 
    require 'soap/wsdlDriver'
    searchWord = ARGV.shift
    # http://www.google.com/apis/饤󥹥ɬפޤ
    key = File.open(File.expand_path("~/.google_key")).read.chomp
    GOOGLE_WSDL = 'http://api.google.com/GoogleSearch.wsdl'
    # Load WSDL and create driver.
    google = SOAP::WSDLDriverFactory.new(GOOGLE_WSDL).create_rpc_driver
    # Just invoke!
    result = google.doGoogleSearch(key, searchWord, 0, 10, false, "", false, "", 'utf-8', 'utf-8')
    result.resultElements.each do |ele|
      puts "== #{ele.title}: #{ele.URL}"
      puts ele.snippet
      puts
    end
  ץȤơAmazonWebServicesRAARNNwsdlDriverѥץ
  sampleǥ쥯ȥ֤Ƥޤ
* xmlscanΥݡȡ
* XML processorθмѹxmlscanREXMLXMLParserNQXMLν
  ޤ
* ɥϥɥ󥰤euc-jp⤷shift_jisȤˤϡ
  xmlscan-0.2Ȥuconv⥸塼뤬ʤƤ⤫ޤޤ󡣤¾XML
  processorȤuconv⥸塼뤬ɬפǤ
* cgistub.rb: SOAP쥹ݥ󥹤ΥǥפѹǤ褦ˤ
  Javaǡtext/xml򿩤ʤĤ
* wsdl2ruby: --forceץɲäޤ
* ΥХ
__EOS__

p rnn.submit(title, text, topic_id)