Hi all,
'SOAP4R' is an implementation of SOAP 1.1 (W3C Note).
RAA: http://raa.ruby-lang.org/project/soap4r
Release Note: http://dev.ctor.org/doc/soap4r/RELEASE_en.html
soap4r/1.5.8 is out. Version 1.5.8 has improved its XML Schema support,
such as class generation of XML Schema anonymous complexType, full
built-in datatypes support of XML Schema Datatypes, and more.
XML Schema feature of soap4r helps to build Ruby mapping of XML Web
services easier when the service has XML Schema definition.
ex1) Yahoo Local Search client
# You need to run xsd2ruby.rb to get the mapper first;
# xsd2ruby.rb --xsd
http://local.yahooapis.com/LocalSearchService/V2/LocalSearchResponse.xsd
- --classdef --mapping_registry --mapper --force
require 'lcl_mapper'
require 'httpclient'
req = {
:appid => "YahooDemo",
:query => "pizza",
:zip => 94306,
:results => 5
}
# use REST API
endpoint = "http://local.yahooapis.com/LocalSearchService/V2/localSearch"
resultxml = HTTPClient.get_content(endpoint, req)
# map the response to Ruby object
lcl_mapper = LclMapper.new
lcl_mapper.xml2obj(resultxml).result.each do |result|
p [result.title, result.phone]
end
ex2) RSS Version 2.0
# You need to run xsd2ruby.rb first;
# xsd2ruby.rb --xsd "http://www.thearchitect.co.uk/schemas/rss-2_0.xsd" \
# --classdef rss2 --mapping_registry --mapper --force
require 'rss2_mapper'
require 'httpclient'
require 'cgi'
# retrieve RSS with httpclient
rssxml =
HTTPClient.get_content("http://www.ruby-lang.org/en/feeds/news.rss")
# parse RSS according to the XML Schema for RSS 2.0
rss_mapper = Rss2Mapper.new
rss = rss_mapper.xml2obj(rssxml)
# update items; this example updates links to point to a local redirector.
rss.channel.item.each do |item|
item.link.map! { |link|
URI.parse("http://localhost/redirector?url=" + CGI.escape(link.to_s))
}
end
# get updated RSS
puts rss_mapper.obj2xml(rss)
/ / /
changes:
http://dev.ctor.org/soap4r/wiki/Changes-158
download:
http://dev.ctor.org/download/soap4r-1.5.8.tar.gz
http://dev.ctor.org/download/soap4r-1.5.8.zip
sha1sum:
de22a95773df0c24e0b1138d11dc67164d07a608 soap4r-1.5.8.tar.gz
213d3bcd5952a524f60845f1885e4f0485687e76 soap4r-1.5.8.zip
gem:
% gem install soap4r --source http://dev.ctor.org/download/
% gem update soap4r --source http://dev.ctor.org/download/
Thanks to all of soap4r-ml members and soap4r users for their support.
Regards,
// NaHi