From: "NAKAMURA, Hiroshi" Date: 2001-03-30T22:34:11+09:00 Subject: [ruby-talk:13355] [ANN] SOAP4R/1.2.0 Hi, I posted SOAP4R/1.2.0 to RAA. In this version, I checked interoperability with Apache-SOAP, pocketSOAP/0.91, SOAP::Lite for Perl, and SOAP/Perl/0.28. It seems to work good except with SOAP/Perl/0.28. * Added href/id unmarshalling support. (href/id marshalling has not been supported yet) * Added SOAP's base64 type support. * SOAPTimeInstant -> SOAPDateTime. Following XML Schema PR. * SOAPStruct can have multiple accessor which have same name. Should I separate it from original SOAPStruct? * Unknown attribute in Header Item raised an exception. Omitted. * Router can handle methods which belong to different namespace. * Added an option to allow unqualified SOAP element. * Added Apache's Map type support. Ruby's Hash are mapped to it now. (Ruby's Hash marshalled by 1.1 processor in the old way can be unmarshalled, but 1.2 processor marshals it in the new way and 1.1 processor does not unmarshals it into Hash. Incompatibility between SOAP4R/1.2 and 1.1) * Unknown type 'unknown:SOAPStruct' was incorrectly unmarshalled into SOAPStruct. Fixed. * Added utility methods map! and members to SOAPArray and SOAPStruct. * Added methods request, response, and fault to SOAPBody. Experimental RAA SOAP server at http://www.ruby-lang.org/~nahi/soap/raa/ used SOAP4R/1.2.0 now. Users, bare in mind the imcompatibility between 1.1 and 1.2 I stated above. To use xmlrpc4r, see [ruby-talk:13154]. Sample soap4r client is as follows. Rather long. Sorry. // NaHi / / / #!/usr/bin/env ruby require 'soap/driver' server = 'http://www.ruby-lang.org/~nahi/soap/raa/' proxy = ARGV.shift || nil # Type Definition RAAInterfaceNS = "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.1" class Category include SOAPSerializable @@typeNamespace = RAAInterfaceNS attr_reader :major, :minor def initialize( major, minor = nil ) @major = major @minor = minor end def to_s "#{ @major }/#{ @minor }" end def ==( rhs ) if @major != rhs.major false elsif !@minor or !rhs.minor true else @minor == rhs.minor end end end class Product include SOAPSerializable @@typeNamespace = RAAInterfaceNS attr_reader :name attr_accessor :version, :status, :homepage, :download, :license, :description def initialize( name, version = nil, status = nil, homepage = nil, download = nil, license = nil, description = nil ) @name = name @version = version @status = status @homepage = homepage @download = download @license = license @description = description end end class Owner include SOAPSerializable @@typeNamespace = RAAInterfaceNS attr_reader :id attr_accessor :email, :name def initialize( email, name ) @email = email @name = name @id = "#{ @email }-#{ @name }" end end class Info include SOAPSerializable @@typeNamespace = RAAInterfaceNS attr_accessor :category, :product, :owner, :update def initialize( category = nil, product = nil, owner = nil, update = nil ) @category = category @product = product @owner = owner @update = update end end ### ## Create Proxy # raa = SOAPDriver.new( Log.new( STDERR ), 'SampleApp', RAAInterfaceNS, server, proxy ) # Method definition. raa.addMethod( 'getAllListings' ) # => Array of String(product name) raa.addMethod( 'getProductTree' ) # => Hash(major category) of Hash(minor category) of Array of String(name) raa.addMethod( 'getInfoFromCategory', 'category' ) # => Array of Info raa.addMethod( 'getModifiedInfoSince', 'time' ) # => Array of Info raa.addMethod( 'getInfoFromName', 'name' ) # => Info ### ## Invoke methods. # p raa.getAllListings() p raa.getProductTree() p raa.getInfoFromCategory( Category.new( "Library", "XML" )) cat = Struct.new( "CCC", "major", "minor" ) p raa.getInfoFromCategory( cat.new( "Library", "XML" )) t = Time.at( Time.now.to_i - 24 * 3600 ) p raa.getModifiedInfoSince( t ) p raa.getModifiedInfoSince( Date.new3( t.year, t.mon, t.mday, t.hour, t.min, t.sec )) p raa.getInfoFromName( "SOAP4R" )