Using Amazon's WSDL services

Discussion in 'Ruby' started by H. Wade Minter, Nov 29, 2005.

  1. I'm trying to create a simple test script to hit Amazon's web services via
    their WSDL listing (specifically the Wishlist Lookup). I'm going on the
    examples in the Pickaxe.

    Here's my sample script:

    #####
    #!/usr/bin/env ruby

    require 'soap/wsdlDriver'

    wsdl = 'http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl'

    soap = SOAP::WSDLDriverFactory.new(wsdl).createDriver

    result = soap.ListLookup
    #####

    However, when I run it, I'm getting a ton of error messages to the screen
    that look like:

    Unknown element {http://www.w3.org/2001/XMLSchema}annotation.
    Unknown attr {}ref.
    Unknown attr {}ref.

    Followed by a final error like:

    soap.rb:10: undefined method `ListLookup' for #<SOAP::WSDLDriver:0x84f7898>
    (NoMethodError)

    I'm not a WSDL expert, so I'm confused as to whether the problem is on my
    end, or on the Amazon end. Anyone better-versed than I willing to take a
    look?

    Thanks,
    Wade
    H. Wade Minter, Nov 29, 2005
    #1
    1. Advertising

  2. H. Wade Minter

    Dave Baldwin Guest

    On 29 Nov 2005, at 13:57, H. Wade Minter wrote:

    > I'm trying to create a simple test script to hit Amazon's web
    > services via
    > their WSDL listing (specifically the Wishlist Lookup). I'm going
    > on the
    > examples in the Pickaxe.
    >
    > Here's my sample script:
    >
    > #####
    > #!/usr/bin/env ruby
    >
    > require 'soap/wsdlDriver'
    >
    > wsdl = 'http://webservices.amazon.com/AWSECommerceService/
    > AWSECommerceService.wsdl'
    >
    > soap = SOAP::WSDLDriverFactory.new(wsdl).createDriver
    >
    > result = soap.ListLookup
    > #####
    >
    > However, when I run it, I'm getting a ton of error messages to the
    > screen
    > that look like:
    >
    > Unknown element {http://www.w3.org/2001/XMLSchema}annotation.
    > Unknown attr {}ref.
    > Unknown attr {}ref.
    >
    > Followed by a final error like:
    >
    > soap.rb:10: undefined method `ListLookup' for #<SOAP::WSDLDriver:
    > 0x84f7898>
    > (NoMethodError)
    >
    > I'm not a WSDL expert, so I'm confused as to whether the problem is
    > on my
    > end, or on the Amazon end. Anyone better-versed than I willing to
    > take a
    > look?
    >
    > Thanks,
    > Wade


    Try using the ruby amazon library
    http://www.caliban.org/ruby/ruby-amazon.shtml

    makes this type of thing so easy. I used it to pull album art:


    require 'open-uri.rb'
    require 'amazon/search'
    include Amazon

    DEV_TOKEN = "XXXXXXXXXXXXXXXX" # you need to register to get
    one of these

    def getArtwork (artist, album)
    image = nil
    re = Regexp.new(album, Regexp::IGNORECASE)
    print "Looking for #{artist}, #{album} ..."
    req = Search::Request.new(DEV_TOKEN, nil, 'uk')
    resp = req.artist_search(artist, 'music', Search::LITE)
    prods = resp.products
    pr = prods.find {|pr| pr.product_name =~ re}
    if pr
    image = open(pr.image_url_small).read
    print "got artwork\n"
    else
    print " not found.\n Possible album names:"
    prods.each {|pr| puts "\t#{pr.product_name}"}
    end
    sleep 1 # don't access amazon too quickly
    image
    end

    Dave.

    >
    Dave Baldwin, Nov 29, 2005
    #2
    1. Advertising

  3. Dave Baldwin <> wrote:
    >
    > Try using the ruby amazon library
    > http://www.caliban.org/ruby/ruby-amazon.shtml
    >
    > makes this type of thing so easy. I used it to pull album art:


    I'd checked that out, but I'm trying to make this as dependent on the Ruby
    base as possible, so people don't have to install extra modules. The
    ruby-amazon is my fallback, but I'd like to get it working with the pure
    standard soap module.

    --Wade
    H. Wade Minter, Nov 29, 2005
    #3
  4. H. Wade Minter

    Jeff Wood Guest

    ------=_Part_9241_32898255.1133278722305
    Content-Type: text/plain; charset=ISO-8859-1
    Content-Transfer-Encoding: quoted-printable
    Content-Disposition: inline

    Although Amazon::Search works, I'd love to see an example that actually
    uses Soap4r and doesn't just do the HTTP requests itself.

    j.


    On 11/29/05, Dave Baldwin <> wrote:
    >
    >
    > On 29 Nov 2005, at 13:57, H. Wade Minter wrote:
    >
    > > I'm trying to create a simple test script to hit Amazon's web
    > > services via
    > > their WSDL listing (specifically the Wishlist Lookup). I'm going
    > > on the
    > > examples in the Pickaxe.
    > >
    > > Here's my sample script:
    > >
    > > #####
    > > #!/usr/bin/env ruby
    > >
    > > require 'soap/wsdlDriver'
    > >
    > > wsdl =3D 'http://webservices.amazon.com/AWSECommerceService/
    > > AWSECommerceService.wsdl'
    > >
    > > soap =3D SOAP::WSDLDriverFactory.new(wsdl).createDriver
    > >
    > > result =3D soap.ListLookup
    > > #####
    > >
    > > However, when I run it, I'm getting a ton of error messages to the
    > > screen
    > > that look like:
    > >
    > > Unknown element {http://www.w3.org/2001/XMLSchema}annotation.
    > > Unknown attr {}ref.
    > > Unknown attr {}ref.
    > >
    > > Followed by a final error like:
    > >
    > > soap.rb:10: undefined method `ListLookup' for #<SOAP::WSDLDriver:
    > > 0x84f7898>
    > > (NoMethodError)
    > >
    > > I'm not a WSDL expert, so I'm confused as to whether the problem is
    > > on my
    > > end, or on the Amazon end. Anyone better-versed than I willing to
    > > take a
    > > look?
    > >
    > > Thanks,
    > > Wade

    >
    > Try using the ruby amazon library
    > http://www.caliban.org/ruby/ruby-amazon.shtml
    >
    > makes this type of thing so easy. I used it to pull album art:
    >
    >
    > require 'open-uri.rb'
    > require 'amazon/search'
    > include Amazon
    >
    > DEV_TOKEN =3D "XXXXXXXXXXXXXXXX" # you need to register to get
    > one of these
    >
    > def getArtwork (artist, album)
    > image =3D nil
    > re =3D Regexp.new(album, Regexp::IGNORECASE)
    > print "Looking for #{artist}, #{album} ..."
    > req =3D Search::Request.new(DEV_TOKEN, nil, 'uk')
    > resp =3D req.artist_search(artist, 'music', Search::LITE)
    > prods =3D resp.products
    > pr =3D prods.find {|pr| pr.product_name =3D~ re}
    > if pr
    > image =3D open(pr.image_url_small).read
    > print "got artwork\n"
    > else
    > print " not found.\n Possible album names:"
    > prods.each {|pr| puts "\t#{pr.product_name}"}
    > end
    > sleep 1 # don't access amazon too quickly
    > image
    > end
    >
    > Dave.
    >
    > >

    >
    >
    >



    --
    "Remember. Understand. Believe. Yield! -> http://ruby-lang.org"

    Jeff Wood

    ------=_Part_9241_32898255.1133278722305--
    Jeff Wood, Nov 29, 2005
    #4
  5. -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Hi,

    Sorry for late reply.

    H. Wade Minter wrote:
    > I'm trying to create a simple test script to hit Amazon's web services via
    > their WSDL listing (specifically the Wishlist Lookup). I'm going on the
    > examples in the Pickaxe.
    >
    > Here's my sample script:
    >
    > #####
    > #!/usr/bin/env ruby
    >
    > require 'soap/wsdlDriver'
    >
    > wsdl = 'http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl'
    >
    > soap = SOAP::WSDLDriverFactory.new(wsdl).createDriver


    Please call a method 'create_rpc_driver' instead of 'createDriver'.
    'createDriver' should work but it is deprecated method.

    > result = soap.ListLookup


    I tried above (with createDriver -> create_rpc_driver modification)
    under ruby-1.8.4 and got different result;

    > /usr/local/lib/ruby/1.8/soap/rpc/driver.rb:230:in `listLookup': wrong number of arguments (0 for 1) (ArgumentError)
    > from /usr/local/lib/ruby/1.8/soap/wsdlDriver.rb:117:in `ListLookup'
    > from list.rb:10


    I think the method 'ListLookup' requires a parameter which is defined as
    'ListLookupRequest' in the WSDL.

    soap.listLookup:)ListLookup => "123")

    returns something for me.

    Regards,
    // NaHi
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.1 (Cygwin)

    iD8DBQFD5HT2f6b33ts2dPkRApM7AKCMNVJnGu+3ztX5pwKZOmWxa7mqsQCgo38M
    BOd+K0Z7pbMbQTIhYHZsWbw=
    =yntq
    -----END PGP SIGNATURE-----
    NAKAMURA, Hiroshi, Feb 4, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dark
    Replies:
    1
    Views:
    4,611
    milfar
    Nov 14, 2008
  2. Chris Bedford
    Replies:
    0
    Views:
    568
    Chris Bedford
    Aug 21, 2003
  3. bruce

    amazon web services/api...

    bruce, Aug 7, 2005, in forum: Python
    Replies:
    0
    Views:
    288
    bruce
    Aug 7, 2005
  4. Replies:
    0
    Views:
    184
  5. Rob Sanheim
    Replies:
    0
    Views:
    268
    Rob Sanheim
    May 2, 2007
Loading...

Share This Page