[#144186] Re: array of object insert polices — "Pe, Botp" <botp@...>

dave [mailto:dave.m@email.it] wrote:

14 messages 2005/06/01

[#144206] Implementing a Read-Only array — Gavin Kistner <gavin@...>

Right up front, let me say that I realize that I can't prevent

14 messages 2005/06/01

[#144224] Method Chaining Issues — "aartist" <aartist@...>

try this:

28 messages 2005/06/01
[#144231] Re: Method Chaining Issues — "Phrogz" <gavin@...> 2005/06/01

This is a FAQ, though no page on the RubyGarden wiki seems to address

[#144240] Re: Method Chaining Issues — Nikolai Weibull <mailing-lists.ruby-talk@...> 2005/06/01

Phrogz wrote:

[#144230] ternary operator confusion — Belorion <belorion@...>

I don't know if this is "improper" use of the ternary operator, but I

19 messages 2005/06/01
[#144233] Re: ternary operator confusion — "Phrogz" <gavin@...> 2005/06/01

true ? a.push(1) : a.push(2)

[#144257] Re: ternary operator confusion — "Marcel Molina Jr." <marcel@...> 2005/06/01

On Thu, Jun 02, 2005 at 01:40:23AM +0900, Phrogz wrote:

[#144263] Re: ternary operator confusion — Eric Mahurin <eric_mahurin@...> 2005/06/01

--- "Marcel Molina Jr." <marcel@vernix.org> wrote:

[#144453] RubyScript2Exe and GUI toolkits — Erik Veenstra <pan@...>

13 messages 2005/06/03

[#144487] Building a business case for Ruby — Joe Van Dyk <joevandyk@...>

Hi,

29 messages 2005/06/03

[#144535] ruby-dev summary 26128-26222 — Minero Aoki <aamine@...>

Hi all,

11 messages 2005/06/04

[#144579] Package, a future replacement for setup.rb and mkmf.rb — Christian Neukirchen <chneukirchen@...>

29 messages 2005/06/04

[#144672] newbie read.scan (?) question — "Bruce D'Arcus" <bdarcus.lists@...>

Hi,

16 messages 2005/06/06

[#144691] making a duck — Eric Mahurin <eric_mahurin@...>

Regarding duck-typing... Is there an easy way make a "duck"?

27 messages 2005/06/06

[#144867] ruby-wish@ruby-lang.org mailing list — dave <dave.m@...>

19 messages 2005/06/08
[#144870] Re: [PROPOSAL] ruby-wish@ruby-lang.org mailing list — "Robert Klemme" <bob.news@...> 2005/06/08

Austin Ziegler wrote:

[#144890] RubyStuff: The Ruby Shop for Ruby Programmers — James Britt <james_b@...>

Announcing the formal grand opening of Ruby Stuff: The Ruby Shop for

36 messages 2005/06/08

[#144966] python/ruby benchmark. — "\"</script>" <groleo@...>

I took a look at

78 messages 2005/06/09
[#144967] Re: python/ruby benchmark. — gabriele renzi <surrender_it@...> 2005/06/09

"</script> ha scritto:

[#144974] Re: python/ruby benchmark. — Lothar Scholz <mailinglists@...> 2005/06/09

Hello gabriele,

[#144977] Re: python/ruby benchmark. — Kent Sibilev <ksruby@...> 2005/06/09

Java is an order of magnitude faster than Ruby. The development of a

[#144980] Re: python/ruby benchmark. — Lothar Scholz <mailinglists@...> 2005/06/09

Hello Kent,

[#144983] Re: python/ruby benchmark. — "Ryan Leavengood" <mrcode@...> 2005/06/09

Lothar Scholz said:

[#145196] Re: python/ruby benchmark(don't shoot the messenger) — ptkwt@... (Phil Tomson) 2005/06/12

In article <9e7db91105061106485b68d629@mail.gmail.com>,

[#145207] Re: python/ruby benchmark(don't shoot the messenger) — Steven Jenkins <steven.jenkins@...> 2005/06/12

Phil Tomson wrote:

[#145212] Re: python/ruby benchmark(don't shoot the messenger) — Austin Ziegler <halostatue@...> 2005/06/12

On 6/12/05, Steven Jenkins <steven.jenkins@ieee.org> wrote:

[#145219] Re: python/ruby benchmark(don't shoot the messenger) — Steven Jenkins <steven.jenkins@...> 2005/06/12

Austin Ziegler wrote:

[#145223] Re: python/ruby benchmark(don't shoot the messenger) — Austin Ziegler <halostatue@...> 2005/06/12

On 6/12/05, Steven Jenkins <steven.jenkins@ieee.org> wrote:

[#145240] Re: python/ruby benchmark(don't shoot the messenger) — Steven Jenkins <steven.jenkins@...> 2005/06/12

Austin Ziegler wrote:

[#145241] Re: python/ruby benchmark(don't shoot the messenger) — Austin Ziegler <halostatue@...> 2005/06/13

On 6/12/05, Steven Jenkins <steven.jenkins@ieee.org> wrote:

[#145000] RDoc

Hi, I have a question. When I compiled ruby-1.8.2

13 messages 2005/06/09
[#145003] Re: RDoc — Eric Hodel <drbrain@...7.net> 2005/06/09

On 09 Jun 2005, at 13:55, Jesffffas Antonio Sfffe1nchez A. wrote:

[#145238] finding Hash subsets based on key value — "ee" <erik.eide@...>

Hi

17 messages 2005/06/12

[#145304] PDF::Writer 1.0 (version 1.0.1) — Austin Ziegler <halostatue@...>

= PDF::Writer

21 messages 2005/06/13
[#145411] Re: [ANN] PDF::Writer 1.0 (version 1.0.1) — Jason Foreman <threeve.org@...> 2005/06/14

No love from PDF::Writer on Mac OS X 10.4.1. I hope to get this fixed

[#145420] Re: [ANN] PDF::Writer 1.0 (version 1.0.1) — Austin Ziegler <halostatue@...> 2005/06/14

On 6/14/05, Jason Foreman <threeve.org@gmail.com> wrote:

[#145432] Re: [ANN] PDF::Writer 1.0 (version 1.0.1) — Jamis Buck <jamis@37signals.com> 2005/06/15

On Jun 14, 2005, at 5:11 PM, Austin Ziegler wrote:

[#145339] survey: what editor do you use to hack ruby? — Lowell Kirsh <lkirsh@...>

I've been having a tough time getting emacs set up properly with ruby

62 messages 2005/06/14

[#145390] Ruby and recursion (Ackermann benchmark) — ptkwt@... (Phil Tomson)

14 messages 2005/06/14

[#145586] How to make a browser in Ruby Tk — sujeet kumar <sujeetkr@...>

Hi

13 messages 2005/06/16

[#145636] Super-scalar Optimizations — "Phrogz" <gavin@...>

I was looking over the shoulder of a C++ coworker yesterday, when he

14 messages 2005/06/16

[#145677] Truth maintenance system in Ruby — "itsme213" <itsme213@...>

Anyone know of any kind of truth-maintenance system implemented in Ruby (or,

12 messages 2005/06/17

[#145720] Frameless RDoc template ('technology preview') — ES <ruby-ml@...>

Hi!

17 messages 2005/06/17

[#145779] Newbe questions... — "Chuck Brotman" <brotman@...>

In Ruby Is there a prefered (or otherwise elegant) way to do an inner &

17 messages 2005/06/18

[#145790] GC.disable not working? — Eric Mahurin <eric_mahurin@...>

From what I can tell, GC.disable doesn't work. I'm wanting to

37 messages 2005/06/18
[#145822] Re: GC.disable not working? — ts <decoux@...> 2005/06/19

>>>>> "E" == Eric Mahurin <eric_mahurin@yahoo.com> writes:

[#146024] evaluation of ruby — "Franz Hartmann" <porschefranz@...> 2005/06/21

Hello all,

[#145830] preventing instantiation — "R. Mark Volkmann" <mark@...>

What is the recommended way in Ruby to prevent other classes from creating

13 messages 2005/06/19
[#145831] Re: preventing instantiation — Gavri Fernandez <gavri.fernandez@...> 2005/06/19

On 6/19/05, R. Mark Volkmann <mark@ociweb.com> wrote:

[#145879] x==1 vs 1==x — Gavin Kistner <gavin@...>

I'm against _premature_ optimization in theory, but believe that a

19 messages 2005/06/20
[#145880] Re: x==1 vs 1==x — ts <decoux@...> 2005/06/20

>>>>> "G" == Gavin Kistner <gavin@refinery.com> writes:

[#145943] Chess Variants (II) (#36) — James Edward Gray II <james@...>

I don't want to spoil all the fun, in case anyone is still attempting

12 messages 2005/06/20

[#146038] 1. Ruby result: 101 seconds , 2. Java result:9.8 seconds, 3. Perl result:62 seconds — Michael Tan <mtan1232000@...>

Just new to Ruby since last week, running my same functional program on the windows XP(Pentium M1.5G), the Ruby version is 10 times slower than the Java version. The program is to find the prime numbers like 2, 3,5, 7, 11, 13... Are there setup issues? or it is normal?

47 messages 2005/06/21
[#146044] Re: 1. Ruby result: 101 seconds , 2. Java result:9.8 seconds, 3. Perl result:62 seconds — "Florian Frank" <flori@...> 2005/06/21

Michael Tan wrote:

[#146047] Re: 1. Ruby result: 101 seconds , 2. Java result:9.8 seconds, 3. Perl result:62 seconds — Jim Freeze <jim@...> 2005/06/21

* Florian Frank <flori@nixe.ping.de> [2005-06-22 05:40:14 +0900]:

[#146050] Re: 1. Ruby result: 101 seconds , 2. Java result:9.8 seconds, 3. Perl result:62 seconds — "Ryan Leavengood" <mrcode@...> 2005/06/21

Jim Freeze said:

[#146132] Re: 1. Ruby result: 101 seconds , 2. Java result:9.8 seconds, 3. Perl result:62 seconds — "Mark Thomas" <mrt@...> 2005/06/22

Florian Frank wrote:

[#146064] rubyscript2exe — Joe Van Dyk <joevandyk@...>

Hi,

14 messages 2005/06/21

[#146169] spidering a website to build a sitemap — Bill Guindon <agorilla@...>

I need to spider a site and build a sitemap for it. I've looked

17 messages 2005/06/22

[#146178] traits-0.4.0 - the coffee release — "Ara.T.Howard" <Ara.T.Howard@...>

15 messages 2005/06/22

[#146328] string to Class object — "R. Mark Volkmann" <mark@...>

How can I create a Class object from a String that contains the name of a class?

15 messages 2005/06/24

[#146380] Application-0.6.0 — Jim Freeze <jim@...>

CommandLine - Application and OptionParser

22 messages 2005/06/24

[#146391] ASP.NET vs Ruby on Rails — Stephen Kellett <snail@...>

HI Folks,

21 messages 2005/06/24
[#146457] Re: ASP.NET vs Ruby on Rails — "Dema" <demetriusnunes@...> 2005/06/25

Hi Stephen,

[#146425] speeding up Process.detach frequency — Joe Van Dyk <joevandyk@...>

Is there any way to speed up Process.detach? The ri documentation for

14 messages 2005/06/25

[#146483] I saw the beauty of Ruby Re: 1. Ruby result: 101 seconds , 2. Java result:9.8 seconds, 3. Perl result:62 seconds — Michael Tan <mtan1232000@...>

22 messages 2005/06/26
[#146485] Re: I saw the beauty of Ruby Re: 1. Ruby result: 101 seconds , 2. Java result:9.8 seconds, 3. Perl result:62 seconds — "Florian Frank" <flori@...> 2005/06/26

Michael Tan wrote:

[#146504] Re: I saw the beauty of Ruby Re: 1. Ruby result: 101 seconds , 2. Java result:9.8 seconds, 3. Perl result:62 seconds — Brad Wilson <dotnetguy@...> 2005/06/26

For comparison, the port of your code to (less than elegant) C#.

[#146515] Re: I saw the beauty of Ruby Re: 1. Ruby result: 101 seconds , 2. Java result:9.8 seconds, 3. Perl result:62 seconds — Florian Gro<florgro@...> 2005/06/26

Brad Wilson wrote:

[#146491] What do you want to see in a Sparklines Library? — Daniel Nugent <nugend@...>

This is sort of an interest gauging/feature request poll.

17 messages 2005/06/26
[#146506] Re: What do you want to see in a Sparklines Library? — Daniel Amelang <daniel.amelang@...> 2005/06/26

See what's already been done before you get too far.

[#146517] Re: What do you want to see in a Sparklines Library? — Daniel Nugent <nugend@...> 2005/06/26

Yup, seen the stuff on RedHanded, I was planning on writing a little

[#146562] RCM - A Ruby Configuration Management System — Michael Neumann <mneumann@...>

Hi all,

22 messages 2005/06/27

[#146630] yield does not take a block — Daniel Brockman <daniel@...>

Under ruby 1.9.0 (2005-06-23) [i386-linux], irb 0.9.5(05/04/13),

48 messages 2005/06/28
[#146666] Re: yield does not take a block — Daniel Brockman <daniel@...> 2005/06/28

Yukihiro Matsumoto <matz@ruby-lang.org> writes:

[#146680] Re: yield does not take a block — Yukihiro Matsumoto <matz@...> 2005/06/28

Hi,

[#146684] Re: yield does not take a block — Eric Mahurin <eric_mahurin@...> 2005/06/28

[#146779] Re: yield does not take a block — "Adam P. Jenkins" <thorin@...> 2005/06/29

Eric Mahurin wrote:

[#146700] Anything in new Eclipse for Rubyists? — "jfry" <jeff.fry@...>

Hey there, I know that a number of folks on the list use Eclipse as

14 messages 2005/06/28

[#146773] Programmers Contest: Fit pictures on a page — hicinbothem@...

GLOSSY: The Summer Programmer Of The Month Contest is underway!

18 messages 2005/06/29

[#146815] shift vs. slice!(0) and others — Eric Mahurin <eric_mahurin@...>

I just did some benchmarking of various ways to insert/delete

12 messages 2005/06/29

soap4r mapping problem when using google adwords api

From: Patrick Chanezon <chanezon@...>
Date: 2005-06-23 13:52:42 UTC
List: ruby-talk #146255
The Google Adwords sample that Nahi included in the samples at
http://dev.ctor.org/soap4r/file/trunk/sample/wsdl/googleAdwords/client.rb
does not work.

In the course of fixing it I ran into a roadblock.
Here's my current fix. I highlight the problems I have fixed, and
areas where I'm not very happy with the fix I found.
---
#!/usr/local/bin/ruby

require 'soap/wsdlDriver'
require 'soap/header/simplehandler'

#wsdl = 'https://adwords.google.com/api/adwords/v2/CampaignService?WSDL'
wsdl = 'CampaignService.wsdl'

class HeaderHandler < SOAP::Header::SimpleHandler
  def initialize(tag, value)
    super(XSD::QName.new(nil, tag))
    @tag = tag
    @value = value
  end

#the initial handler from the sample was wrong, it generated 2 level of tags
  def on_simple_outbound
    @value
  end
end

#problem: wsdl2ruby does not pick up soap/property file, so yields a
certificate error when running against this https url
#run it on local file
# To generate deafult.rb, do like this;
# % wsdl2ruby.rb --wsdl
"https://adwords.google.com/api/adwords/v2/CampaignService?WSDL"
--classdef --force
require 'default'

# I don't have an account of AdWords so the following code is not tested.
# Please tell me (nahi@ruby-lang.org) if you will get good/bad result in
# communicating with AdWords Server...
drv = SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
#problem: http protocol properties set in soap/property from rubyhome
are not picked up
drv.loadproperty('soap/property')
#print drv.options["client"]["ssl_config"].inspect
#problem: wiredump_dev does not output anything when running in SSL mode
drv.wiredump_dev = STDOUT
#the file based logger works
drv.wiredump_file_base = "log"
drv.headerhandler << HeaderHandler.new('email', 'patlist@chanezon.com')
drv.headerhandler << HeaderHandler.new('password', 'your_password_here')
drv.headerhandler << HeaderHandler.new('useragent', 'P@ playing with
the API from ruby')
drv.headerhandler << HeaderHandler.new('token', 'your_token_here')
camplist = drv.call("getAllAdWordsCampaigns", GetAllAdWordsCampaigns.new(123))
print camplist
---

When I run that with a valid adwords developer account, the call is
made and the correct repsonse is sent back, as seen in the filke log.
However the mapper barfs.

I incldue the relevant data.
Any idea of where to look for next is welcome.
I run soap4r soap4r-1_5_4, which seem to have fixed a few things
regarding doc/literal encoding style.

stack trace
/usr/lib/ruby/1.8/soap/mapping/wsdlliteralregistry.rb:73: warning:
Object#type is deprecated; use Object#class
/usr/lib/ruby/1.8/soap/mapping/wsdlliteralregistry.rb:73:in
`soap2obj': cannot map SOAP::SOAPElement to Ruby object
(SOAP::Mapping::MappingError)
        from /usr/lib/ruby/1.8/soap/mapping/mapping.rb:126:in `_soap2obj'
        from /usr/lib/ruby/1.8/soap/mapping/mapping.rb:49:in `soap2obj'
        from /usr/lib/ruby/1.8/soap/rpc/proxy.rb:417:in `response_doc_lit'
        from /usr/lib/ruby/1.8/soap/rpc/proxy.rb:416:in `collect'
        from /usr/lib/ruby/1.8/soap/rpc/proxy.rb:416:in `each'
        from /usr/lib/ruby/1.8/soap/baseData.rb:473:in `each'
        from /usr/lib/ruby/1.8/soap/baseData.rb:473:in `each'
        from /usr/lib/ruby/1.8/soap/rpc/proxy.rb:416:in `collect'
        from /usr/lib/ruby/1.8/soap/rpc/proxy.rb:416:in `response_doc_lit'
        from /usr/lib/ruby/1.8/soap/rpc/proxy.rb:382:in `response_doc'
        from /usr/lib/ruby/1.8/soap/rpc/proxy.rb:289:in `response_obj'
        from /usr/lib/ruby/1.8/soap/rpc/proxy.rb:129:in `call'
        from /usr/lib/ruby/1.8/soap/rpc/driver.rb:177:in `call'
        from ./client.rb:44
in soap2obj #<SOAP::SOAPElement:0x369636
{https://adwords.google.com/api/adwords/v2}getAllAdWordsCampaignsResponse>

the trace in soap2obj is a print node.inspect

here is the response log
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Header><responseTime
soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"
soapenv:mustUnderstand="0"
xmlns="https://adwords.google.com/api/adwords/v2">23</responseTime><operations
soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"
soapenv:mustUnderstand="0"
xmlns="https://adwords.google.com/api/adwords/v2">3</operations></soapenv:Header>
<soapenv:Body>
<getAllAdWordsCampaignsResponse
xmlns="https://adwords.google.com/api/adwords/v2">
<getAllAdWordsCampaignsReturn><id>6000213</id><name>Campaign
#1</name><status>Active</status><startDate>2005-04-16T21:27:50.000Z</startDate><endDate>2011-01-01T07:59:59.000Z</endDate><dailyBudget>1000000</dailyBudget><optInSearchNetwork>true</optInSearchNetwork><optInContentNetwork>true</optInContentNetwork><languageTargeting><languages>en</languages></languageTargeting><geoTargeting
xsi:nil="true"/></getAllAdWordsCampaignsReturn>
...
</getAllAdWordsCampaignsResponse></soapenv:Body></soapenv:Envelope>

It seems to barf on <getAllAdWordsCampaignsResponse
xmlns="https://adwords.google.com/api/adwords/v2">

Here is the rb file generated by wsdl2ruby
require 'xsd/qname'

# {https://adwords.google.com/api/adwords/v2}getCampaign
class GetCampaign
  @@schema_type = "getCampaign"
  @@schema_ns = "https://adwords.google.com/api/adwords/v2"
  @@schema_element = [["id", "SOAP::SOAPInt"]]

  attr_accessor :id

  def initialize(id = nil)
    @id = id
  end
end

# {https://adwords.google.com/api/adwords/v2}getCampaignResponse
class GetCampaignResponse
  @@schema_type = "getCampaignResponse"
  @@schema_ns = "https://adwords.google.com/api/adwords/v2"
  @@schema_element = [["getCampaignReturn", "Campaign"]]

  attr_accessor :getCampaignReturn

  def initialize(getCampaignReturn = nil)
    @getCampaignReturn = getCampaignReturn
  end
end

# {https://adwords.google.com/api/adwords/v2}getCampaignList
class GetCampaignList
  @@schema_type = "getCampaignList"
  @@schema_ns = "https://adwords.google.com/api/adwords/v2"
  @@schema_element = [["ids", "SOAP::SOAPInt[]"]]

  attr_accessor :ids

  def initialize(ids = [])
    @ids = ids
  end
end

# {https://adwords.google.com/api/adwords/v2}getCampaignListResponse
class GetCampaignListResponse
  @@schema_type = "getCampaignListResponse"
  @@schema_ns = "https://adwords.google.com/api/adwords/v2"
  @@schema_element = [["getCampaignListReturn", "Campaign[]"]]

  attr_accessor :getCampaignListReturn

  def initialize(getCampaignListReturn = [])
    @getCampaignListReturn = getCampaignListReturn
  end
end

# {https://adwords.google.com/api/adwords/v2}getAllAdWordsCampaigns
class GetAllAdWordsCampaigns
  @@schema_type = "getAllAdWordsCampaigns"
  @@schema_ns = "https://adwords.google.com/api/adwords/v2"
  @@schema_element = [["dummy", "SOAP::SOAPInt"]]

  attr_accessor :dummy

  def initialize(dummy = nil)
    @dummy = dummy
  end
end

# {https://adwords.google.com/api/adwords/v2}getAllAdWordsCampaignsResponse
class GetAllAdWordsCampaignsResponse
  @@schema_type = "getAllAdWordsCampaignsResponse"
  @@schema_ns = "https://adwords.google.com/api/adwords/v2"
  @@schema_element = [["getAllAdWordsCampaignsReturn", "Campaign[]"]]

  attr_accessor :getAllAdWordsCampaignsReturn

  def initialize(getAllAdWordsCampaignsReturn = [])
    @getAllAdWordsCampaignsReturn = getAllAdWordsCampaignsReturn
  end
end

# {https://adwords.google.com/api/adwords/v2}addCampaign
class AddCampaign
  @@schema_type = "addCampaign"
  @@schema_ns = "https://adwords.google.com/api/adwords/v2"
  @@schema_element = [["campaign", "Campaign"]]

  attr_accessor :campaign

  def initialize(campaign = nil)
    @campaign = campaign
  end
end

# {https://adwords.google.com/api/adwords/v2}addCampaignResponse
class AddCampaignResponse
  @@schema_type = "addCampaignResponse"
  @@schema_ns = "https://adwords.google.com/api/adwords/v2"
  @@schema_element = [["addCampaignReturn", "Campaign"]]

  attr_accessor :addCampaignReturn

  def initialize(addCampaignReturn = nil)
    @addCampaignReturn = addCampaignReturn
  end
end

# {https://adwords.google.com/api/adwords/v2}addCampaignList
class AddCampaignList
  @@schema_type = "addCampaignList"
  @@schema_ns = "https://adwords.google.com/api/adwords/v2"
  @@schema_element = [["campaigns", "Campaign[]"]]

  attr_accessor :campaigns

  def initialize(campaigns = [])
    @campaigns = campaigns
  end
end

# {https://adwords.google.com/api/adwords/v2}addCampaignListResponse
class AddCampaignListResponse
  @@schema_type = "addCampaignListResponse"
  @@schema_ns = "https://adwords.google.com/api/adwords/v2"
  @@schema_element = [["addCampaignListReturn", "Campaign[]"]]

  attr_accessor :addCampaignListReturn

  def initialize(addCampaignListReturn = [])
    @addCampaignListReturn = addCampaignListReturn
  end
end

# {https://adwords.google.com/api/adwords/v2}updateCampaign
class UpdateCampaign
  @@schema_type = "updateCampaign"
  @@schema_ns = "https://adwords.google.com/api/adwords/v2"
  @@schema_element = [["campaign", "Campaign"]]

  attr_accessor :campaign

  def initialize(campaign = nil)
    @campaign = campaign
  end
end

# {https://adwords.google.com/api/adwords/v2}updateCampaignResponse
class UpdateCampaignResponse
  @@schema_type = "updateCampaignResponse"
  @@schema_ns = "https://adwords.google.com/api/adwords/v2"
  @@schema_element = []

  def initialize
  end
end

# {https://adwords.google.com/api/adwords/v2}updateCampaignList
class UpdateCampaignList
  @@schema_type = "updateCampaignList"
  @@schema_ns = "https://adwords.google.com/api/adwords/v2"
  @@schema_element = [["campaigns", "Campaign[]"]]

  attr_accessor :campaigns

  def initialize(campaigns = [])
    @campaigns = campaigns
  end
end

# {https://adwords.google.com/api/adwords/v2}updateCampaignListResponse
class UpdateCampaignListResponse
  @@schema_type = "updateCampaignListResponse"
  @@schema_ns = "https://adwords.google.com/api/adwords/v2"
  @@schema_element = []

  def initialize
  end
end

# {https://adwords.google.com/api/adwords/v2}getOptimizeAdServing
class GetOptimizeAdServing
  @@schema_type = "getOptimizeAdServing"
  @@schema_ns = "https://adwords.google.com/api/adwords/v2"
  @@schema_element = [["campaignId", "SOAP::SOAPInt"]]

  attr_accessor :campaignId

  def initialize(campaignId = nil)
    @campaignId = campaignId
  end
end

# {https://adwords.google.com/api/adwords/v2}getOptimizeAdServingResponse
class GetOptimizeAdServingResponse
  @@schema_type = "getOptimizeAdServingResponse"
  @@schema_ns = "https://adwords.google.com/api/adwords/v2"
  @@schema_element = [["getOptimizeAdServingReturn", "SOAP::SOAPBoolean"]]

  attr_accessor :getOptimizeAdServingReturn

  def initialize(getOptimizeAdServingReturn = nil)
    @getOptimizeAdServingReturn = getOptimizeAdServingReturn
  end
end

# {https://adwords.google.com/api/adwords/v2}setOptimizeAdServing
class SetOptimizeAdServing
  @@schema_type = "setOptimizeAdServing"
  @@schema_ns = "https://adwords.google.com/api/adwords/v2"
  @@schema_element = [["campaignId", "SOAP::SOAPInt"], ["enable",
"SOAP::SOAPBoolean"]]

  attr_accessor :campaignId
  attr_accessor :enable

  def initialize(campaignId = nil, enable = nil)
    @campaignId = campaignId
    @enable = enable
  end
end

# {https://adwords.google.com/api/adwords/v2}setOptimizeAdServingResponse
class SetOptimizeAdServingResponse
  @@schema_type = "setOptimizeAdServingResponse"
  @@schema_ns = "https://adwords.google.com/api/adwords/v2"
  @@schema_element = []

  def initialize
  end
end

# {https://adwords.google.com/api/adwords/v2}getCampaignStats
class GetCampaignStats
  @@schema_type = "getCampaignStats"
  @@schema_ns = "https://adwords.google.com/api/adwords/v2"
  @@schema_element = [["campaignIds", "SOAP::SOAPInt[]"], ["start",
"SOAP::SOAPDateTime"], ["v_end", ["SOAP::SOAPDateTime",
XSD::QName.new(nil, "end")]]]

  attr_accessor :campaignIds
  attr_accessor :start

  def end
    @v_end
  end

  def end=(value)
    @v_end = value
  end

  def initialize(campaignIds = [], start = nil, v_end = nil)
    @campaignIds = campaignIds
    @start = start
    @v_end = v_end
  end
end

# {https://adwords.google.com/api/adwords/v2}getCampaignStatsResponse
class GetCampaignStatsResponse
  @@schema_type = "getCampaignStatsResponse"
  @@schema_ns = "https://adwords.google.com/api/adwords/v2"
  @@schema_element = [["getCampaignStatsReturn", "StatsRecord[]"]]

  attr_accessor :getCampaignStatsReturn

  def initialize(getCampaignStatsReturn = [])
    @getCampaignStatsReturn = getCampaignStatsReturn
  end
end

# {https://adwords.google.com/api/adwords/v2}Keyword
class Keyword
  @@schema_type = "Keyword"
  @@schema_ns = "https://adwords.google.com/api/adwords/v2"
  @@schema_element = [["type", "KeywordType"], ["maxCpc",
"SOAP::SOAPLong"], ["adGroupId", "SOAP::SOAPInt"], ["language",
"SOAP::SOAPString"], ["status", "KeywordStatus"], ["negative",
"SOAP::SOAPBoolean"], ["destinationUrl", "SOAP::SOAPString"], ["text",
"SOAP::SOAPString"], ["id", "SOAP::SOAPInt"], ["exemptionRequest",
"SOAP::SOAPString"]]

  attr_accessor :type
  attr_accessor :maxCpc
  attr_accessor :adGroupId
  attr_accessor :language
  attr_accessor :status
  attr_accessor :negative
  attr_accessor :destinationUrl
  attr_accessor :text
  attr_accessor :id
  attr_accessor :exemptionRequest

  def initialize(type = nil, maxCpc = nil, adGroupId = nil, language =
nil, status = nil, negative = nil, destinationUrl = nil, text = nil,
id = nil, exemptionRequest = nil)
    @type = type
    @maxCpc = maxCpc
    @adGroupId = adGroupId
    @language = language
    @status = status
    @negative = negative
    @destinationUrl = destinationUrl
    @text = text
    @id = id
    @exemptionRequest = exemptionRequest
  end
end

# {https://adwords.google.com/api/adwords/v2}LanguageTarget
class LanguageTarget < ::Array
  @@schema_type = "string"
  @@schema_ns = "http://www.w3.org/2001/XMLSchema"
end

# {https://adwords.google.com/api/adwords/v2}GeoTarget
class GeoTarget
  @@schema_type = "GeoTarget"
  @@schema_ns = "https://adwords.google.com/api/adwords/v2"
  @@schema_element = [["countries", "SOAP::SOAPString[]"], ["regions",
"SOAP::SOAPString[]"], ["metros", "SOAP::SOAPString[]"], ["cities",
"SOAP::SOAPString[]"]]

  attr_accessor :countries
  attr_accessor :regions
  attr_accessor :metros
  attr_accessor :cities

  def initialize(countries = [], regions = [], metros = [], cities = [])
    @countries = countries
    @regions = regions
    @metros = metros
    @cities = cities
  end
end

# {https://adwords.google.com/api/adwords/v2}Campaign
class Campaign
  @@schema_type = "Campaign"
  @@schema_ns = "https://adwords.google.com/api/adwords/v2"
  @@schema_element = [["id", "SOAP::SOAPInt"], ["name",
"SOAP::SOAPString"], ["status", "CampaignStatus"], ["startDate",
"SOAP::SOAPDateTime"], ["endDate", "SOAP::SOAPDateTime"],
["dailyBudget", "SOAP::SOAPLong"], ["optInSearchNetwork",
"SOAP::SOAPBoolean"], ["optInContentNetwork", "SOAP::SOAPBoolean"],
["campaignNegativeKeywords", "Keyword[]"], ["languageTargeting",
"LanguageTarget"], ["geoTargeting", "GeoTarget"]]

  attr_accessor :id
  attr_accessor :name
  attr_accessor :status
  attr_accessor :startDate
  attr_accessor :endDate
  attr_accessor :dailyBudget
  attr_accessor :optInSearchNetwork
  attr_accessor :optInContentNetwork
  attr_accessor :campaignNegativeKeywords
  attr_accessor :languageTargeting
  attr_accessor :geoTargeting

  def initialize(id = nil, name = nil, status = nil, startDate = nil,
endDate = nil, dailyBudget = nil, optInSearchNetwork = nil,
optInContentNetwork = nil, campaignNegativeKeywords = [],
languageTargeting = nil, geoTargeting = nil)
    @id = id
    @name = name
    @status = status
    @startDate = startDate
    @endDate = endDate
    @dailyBudget = dailyBudget
    @optInSearchNetwork = optInSearchNetwork
    @optInContentNetwork = optInContentNetwork
    @campaignNegativeKeywords = campaignNegativeKeywords
    @languageTargeting = languageTargeting
    @geoTargeting = geoTargeting
  end
end

# {https://adwords.google.com/api/adwords/v2}ApiException
class ApiException
  @@schema_type = "ApiException"
  @@schema_ns = "https://adwords.google.com/api/adwords/v2"
  @@schema_element = [["code", "SOAP::SOAPInt"], ["internal",
"SOAP::SOAPBoolean"], ["message", "SOAP::SOAPString"], ["trigger",
"SOAP::SOAPString"], ["violations", "SOAP::SOAPString"]]

  attr_accessor :code
  attr_accessor :internal
  attr_accessor :message
  attr_accessor :trigger
  attr_accessor :violations

  def initialize(code = nil, internal = nil, message = nil, trigger =
nil, violations = nil)
    @code = code
    @internal = internal
    @message = message
    @trigger = trigger
    @violations = violations
  end
end

# {https://adwords.google.com/api/adwords/v2}StatsRecord
class StatsRecord
  @@schema_type = "StatsRecord"
  @@schema_ns = "https://adwords.google.com/api/adwords/v2"
  @@schema_element = [["averagePosition", "SOAP::SOAPDouble"],
["clicks", "SOAP::SOAPLong"], ["conversionRate", "SOAP::SOAPDouble"],
["conversions", "SOAP::SOAPLong"], ["cost", "SOAP::SOAPLong"], ["id",
"SOAP::SOAPLong"], ["impressions", "SOAP::SOAPLong"]]

  attr_accessor :averagePosition
  attr_accessor :clicks
  attr_accessor :conversionRate
  attr_accessor :conversions
  attr_accessor :cost
  attr_accessor :id
  attr_accessor :impressions

  def initialize(averagePosition = nil, clicks = nil, conversionRate =
nil, conversions = nil, cost = nil, id = nil, impressions = nil)
    @averagePosition = averagePosition
    @clicks = clicks
    @conversionRate = conversionRate
    @conversions = conversions
    @cost = cost
    @id = id
    @impressions = impressions
  end
end

# {https://adwords.google.com/api/adwords/v2}KeywordStatus
module KeywordStatus
  Deleted = "Deleted"
  Disabled = "Disabled"
  Disapproved = "Disapproved"
  InTrial = "InTrial"
  Normal = "Normal"
  OnHold = "OnHold"
end

# {https://adwords.google.com/api/adwords/v2}KeywordType
module KeywordType
  Broad = "Broad"
  Exact = "Exact"
  Phrase = "Phrase"
end

# {https://adwords.google.com/api/adwords/v2}CampaignStatus
module CampaignStatus
  Active = "Active"
  Deleted = "Deleted"
  Ended = "Ended"
  Paused = "Paused"
  Pending = "Pending"
  Suspended = "Suspended"
end

The error happens in soap/mapping/wsdlliteralregistry.rb

  # node should be a SOAPElement
  def soap2obj(node, obj_class = nil)
          print "in soap2obj #{node.inspect}"
    unless obj_class.nil?
      raise MappingError.new("must not reach here")
    end
    begin
      return any2obj(node)
    rescue MappingError
    end
    if @excn_handler_soap2obj
      begin
        return @excn_handler_soap2obj.call(node) { |yield_node|
            Mapping._soap2obj(yield_node, self)
          }
      rescue Exception
      end
    end
    raise MappingError.new("cannot map #{node.type.name} to Ruby object")
  end

I guess the problem must lie in the fact that the class
GetAllAdWordsCampaignsResponse is not known to the registry, to be
applied to the response element
{https://adwords.google.com/api/adwords/v2}getAllAdWordsCampaignsResponse>

# {https://adwords.google.com/api/adwords/v2}getAllAdWordsCampaignsResponse
class GetAllAdWordsCampaignsResponse
  @@schema_type = "getAllAdWordsCampaignsResponse"
  @@schema_ns = "https://adwords.google.com/api/adwords/v2"
  @@schema_element = [["getAllAdWordsCampaignsReturn", "Campaign[]"]]

How is this registry informed about the classes that must be used for
mapping when using the wsdl files?
Is there a message to be sent to drv in order to let it know about
default.rb classes?

A few hours later after finding this other sample
I now generate the client driver myself using wsdl2ruby
wsdl2ruby.rb --wsdl CampaignService.wsdl --type client

Now I understand where the mapping is defined.
Still the new program yields the same error

---
#!/usr/local/bin/ruby

require 'soap/wsdlDriver'
require 'soap/header/simplehandler'

wsdl = 'https://adwords.google.com/api/adwords/v2/CampaignService?WSDL'

class HeaderHandler < SOAP::Header::SimpleHandler
  def initialize(tag, value)
    super(XSD::QName.new(nil, tag))
    @tag = tag
    @value = value
  end

#the initial handler from the sample was wrong, it generated 2 level of tags
  def on_simple_outbound
    @value
  end
end

#problem: wsdl2ruby does not pick up soap/property file, so yields a
certificate error when running against this https url
#run it on local file
# To generate deafult.rb, do like this;
# % wsdl2ruby.rb --wsdl
"https://adwords.google.com/api/adwords/v2/CampaignService?WSDL"
--classdef --force
#require 'default'

# I don't have an account of AdWords so the following code is not tested.
# Please tell me (nahi@ruby-lang.org) if you will get good/bad result in
# communicating with AdWords Server...
#drv = SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver

require 'defaultDriver.rb'
require 'yaml'

prefs = YAML::load( File.open('adwords.yaml', 'r'))
headers = prefs['headers']

drv = CampaignService.new()

#problem: http protocol properties set in soap/property from rubyhome
are not picked up
drv.loadproperty('soap/property')
#problem: wiredump_dev does not output anything when running in SSL mode
#drv.wiredump_dev = STDOUT
#the file based logger works
drv.wiredump_file_base = "log"

headers.each {|key, value| drv.headerhandler << HeaderHandler.new(key, value)}

puts drv.getAllAdWordsCampaigns(GetAllAdWordsCampaigns.new(123))
---

/usr/lib/ruby/1.8/soap/mapping/wsdlliteralregistry.rb:73:in
`soap2obj': cannot map SOAP::SOAPElement to Ruby object
(SOAP::Mapping::MappingError)
        from /usr/lib/ruby/1.8/soap/mapping/mapping.rb:126:in `_soap2obj'
        from /usr/lib/ruby/1.8/soap/mapping/mapping.rb:49:in `soap2obj'
        from /usr/lib/ruby/1.8/soap/rpc/proxy.rb:417:in `response_doc_lit'
        from /usr/lib/ruby/1.8/soap/rpc/proxy.rb:416:in `collect'
        from /usr/lib/ruby/1.8/soap/rpc/proxy.rb:416:in `each'
        from /usr/lib/ruby/1.8/soap/baseData.rb:473:in `each'
        from /usr/lib/ruby/1.8/soap/baseData.rb:473:in `each'
        from /usr/lib/ruby/1.8/soap/rpc/proxy.rb:416:in `collect'
        from /usr/lib/ruby/1.8/soap/rpc/proxy.rb:416:in `response_doc_lit'
        from /usr/lib/ruby/1.8/soap/rpc/proxy.rb:382:in `response_doc'
        from /usr/lib/ruby/1.8/soap/rpc/proxy.rb:289:in `response_obj'
        from /usr/lib/ruby/1.8/soap/rpc/proxy.rb:129:in `call'
        from /usr/lib/ruby/1.8/soap/rpc/driver.rb:177:in `call'
        from /usr/lib/ruby/1.8/soap/rpc/driver.rb:231:in
`getAllAdWordsCampaigns'
        from /usr/lib/ruby/1.8/soap/rpc/driver.rb:226:in
`getAllAdWordsCampaigns'
        from ./client.rb:39
in soap2obj #<SOAP::SOAPElement:0x36be68
{https://adwords.google.com/api/adwords/v2}getAllAdWordsCampaignsResponse>

It is as if the mapping defined in CampaignService is not used.

Thanks in advance for any hints.

P@


In This Thread

Prev Next