Hi,

> From: "Ben Schumacher" <ben / blahr.com>
> Sent: Thursday, February 13, 2003 2:08 AM

> > Oops.  I found that I didn't commit soap4r/sample/Amazon/* files before
> > releasing soap4r/1.4.8...
> >
> > Try
> > $ /bin/wsdl2ruby.rb --wsdl http://soap.amazon.com/schemas2/AmazonWebServices.wsdl --classDef --force
> >
> > It should create AmazonSearch.rb in the current directory.

> So I just fill in the details on these classes and send it along as part
> of my query? Sounds nifty. Thanks for your help.

Yes.  And you don't have to change the class definitions.

$ wsdl2ruby.rb --wsdl http://soap.amazon.com/schemas2/AmazonWebServices.wsdl --classDef --force
I, [2003-02-13T08:46:02.776531 #3204]  INFO -- app: Start of app.
I, [2003-02-13T08:46:04.956531 #3204]  INFO -- app: Creating class definition.
I, [2003-02-13T08:46:04.968531 #3204]  INFO -- app: Creates file 'AmazonSearch.rb'.
I, [2003-02-13T08:46:05. 62531 #3204]  INFO -- app: End of app. (status: 0)

$ cat wsdlDriver.rb
require 'soap/wsdlDriver'

searchBook = ARGV.shift || "Ruby"

require 'AmazonSearch.rb'

# You must get 'developer's token" from http://associates.amazon.com/exec/panama/associates/ntg/browse/-/1067662 to use Amazon Web
Services 2.0.
devtag = File.open(File.expand_path("~/.amazon_key")).read.chomp

AMAZON_WSDL = 'http://soap.amazon.com/schemas2/AmazonWebServices.wsdl'
amazon = SOAP::WSDLDriverFactory.new(AMAZON_WSDL).createDriver
amazon.generateEncodeType = true
#amazon.setWireDumpDev(STDERR)

# Show sales rank.
req = KeywordRequest.new(searchBook, "1", "books", "webservices-20", "lite", devtag, "+salesrank")
amazon.KeywordSearchRequest(req).Details.each do |detail|
  puts "== #{detail.ProductName}"
  puts "Author: #{detail.Authors.join(", ")}"
  puts "Release date: #{detail.ReleaseDate}"
  puts "List price: #{detail.ListPrice}, our price: #{detail.OurPrice}"
  puts
end

$ ruby wsdlDriver.rb "Ruby language"
== Programming Ruby: A Pragmatic Programmer's Guide
Author: David Thomas, Andrew Hunt, Dave Thomas
Release date: 15 December, 2000
List price: $42.95, our price: $42.95

== The Ruby Way
Author: Hal Fulton
Release date: 17 December, 2001
List price: $39.99, our price: $27.99

== Ruby In A Nutshell
Author: Yukihiro Matsumoto
Release date: November, 2001
List price: $24.95, our price: $17.47

== Ruby Developer's Guide
Author: Robert Feldt, Lyle Johnson, Michael Neumann, Lyle Johnson, Jonothon Ortiz
Release date: 18 January, 2002
List price: $49.95, our price: $34.97

== Making Use of Ruby
Author: Suresh Mahadevan, Rashi Gupta, Shweta Bhasin, Madhushree Ganguly, Ashok Appu
Release date: 15 July, 2002
List price: $35.00, our price: $24.50

== Sams Teach Yourself Ruby in 21 Days
Author: Mark Slagell
Release date: 22 March, 2002
List price: $39.99, our price: $27.99

== Writing and Grammar: Communication in Action: Ruby Grade 11
Author: Joyce Armstrong Carroll, Edward E. Wilson, Gary Forlini
Release date: January, 2001
List price: $71.00, our price: $71.00

== Teacher's Guide for an Introduction to Kings, Later Prophets and Writings
Author: Shirley Newman, Myra Yedwab, Lillian Adler, Ruby G. Strauss
Release date: October, 1996
List price: $14.95, our price: $14.95

== The Puerto Ricans: Culture Change and Language Deviance (Viking Fund Publications in Anthropology, No. 51)
Author: Ruby Rohrlich, Ruby Rohrlich-Leavitt
Release date: June, 1974
List price: $11.95, our price: $11.95

== The Hebrew Primer
Author: Ahuva Schuller, Lillian Adler, Ruby G. Strauss, Guy Brison-Stack
Release date: October, 1996
List price: $9.50, our price: $9.50

$

Hmm.  It seems that "Lyle Johnson"-san is doubled at
"Ruby Developer's Guide" in Amazon's DB...

Regards,
// NaHi