Welcome to the "trac"-ing site of soap4r!
[soap4r] [httpclient] [openpgp4u] [pkcs1] [logger] [csv] [vtr]

root/trunk/sample/basic/flickr.rb

Revision 1843, 0.7 kB (checked in by nahi, 1 year ago)
  • reorganize sampless
Line 
1 require 'soap/rpc/driver'
2
3 api_key = ARGV.shift or raise
4
5 flickr = SOAP::RPC::Driver.new('http://www.flickr.com/services/soap/')
6 flickr.wiredump_dev = STDOUT if $DEBUG
7
8 flickr.add_document_method('request', nil,
9   XSD::QName.new('urn:flickr', 'FlickrRequest'),
10   XSD::QName.new('urn:flickr', 'FlickrResponse'))
11
12 soap12namespace = 'http://www.w3.org/2003/05/soap-envelope'
13 flickr.options['soap.envelope.requestnamespace'] = soap12namespace
14 flickr.options['soap.envelope.responsenamespace'] = soap12namespace
15
16 response = flickr.request(
17   :api_key => api_key,
18   :method => 'flickr.test.echo',
19   :name => 'hello world')
20
21 responsexml = "<dummy>#{response}</dummy>"
22
23 require 'xsd/mapping'
24 obj = XSD::Mapping.xml2obj(responsexml)
25 p obj.method
26 p obj.name
Note: See TracBrowser for help on using the browser.