Index: [Article Count Order] [Thread]

Date:  Thu, 21 Mar 2002 22:01:38 +1200
From:  Holden Glova <dsafari@xtra.co.nz>
Subject:  [webricken:67] soaplet confusion saga
To:  webricken@notwork.org
Message-Id:  <20020321095625.ZOSJ4403.mta2-rme.xtra.co.nz@there>
X-Mail-Count: 00067

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello folks,

I have a few soaplets that seem to return me the correct results, only I 
can't seem to access the data in the objects returned.

One of my services returns an array of objects, whenever I try access one of 
the methods in those objects i get NameError, undefined method.

I'm pretty sure the soaplet is working because the correct objects seem to 
come back when I view them all through #inspect. 

Below is the output from when I run the client, any help is greatly 
appreciated.

Here is the code segment.

<CODE-SNIPPET>

def initialize
    @package_name = ''
  
    opt_parser = GetoptLong.new(*OPTION_LIST)
    opt_parser.quiet = true
    
    usage if ARGV.length == 0
    
    opt_parser.each do |opt, arg|
      case opt
        when '--query'
          package_name = arg
          @action = proc { query_raa(package_name) } 
          break
          
        when '--show'
          package_name = arg
          @action = proc { show_from_raa(package_name) }
          break
          
        else
          usage
      end
    end
   
  rescue GetoptLong::InvalidOption => error
    usage(error.message)
  rescue GetoptLong::MissingArgument => error
    usage(error.message)
  end
  
  
  def start
    server = 'http://localhost:2020/soap'
    namespace = 'urn:raaServices-simpleFinder'
    proxy = nil
    
    @raa = SOAP::Driver.new(nil, nil, namespace, server, proxy)
    @raa.addMethod('search_for_entry_names', 'entry_name')
    #finder.addMethod('search_for_entry_index')
    
    @action.call
  end
  
  
  def query_raa(package_name)
    entry_indexes = @raa.search_for_entry_names(package_name)
    puts entry_indexes[0].type.to_s
    puts entry_indexes[0].inspect
    puts entry_indexes[0].name
  end
  private :query_raa

</CODE-SNIPPET>

<OUTPUT>
synack@eugene:~/ruby/raa-succ$ ./raa-wrapper-client.rb --query ri
RAA::Proxy
#<RAA::Proxy:0x402cfbe8 @name="Active attribute">
./raa-wrapper-client.rb:85:in `query_raa': undefined method `name' for 
#<RAA::Proxy:0x402cfbe8> (NameError)
        from ./raa-wrapper-client.rb:48:in `initialize'
        from ./raa-wrapper-client.rb:48:in `call'
        from ./raa-wrapper-client.rb:77:in `start'
        from ./raa-wrapper-client.rb:101
</OUTPUT>

- -- 
Signed,
Holden Glova
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE8ma+D+mF116Lw2cQRAgcgAKCHtMk76i6CazZNwhKoAQcPcS3vwwCgi8q6
8QIpcRBDx9Qum72dJFccFvo=
=ZCW3
-----END PGP SIGNATURE-----