Welcome to the "trac"-ing site of soap4r!
[soap4r] [httpclient] [openpgp4u] [pkcs1] [logger] [csv] [vtr]

Ticket #234 (closed enhancement: fixed)

Opened 2 years ago

Last modified 2 years ago

generate_explicit_type for ltieral service

Reported by: nahi Assigned to: nahi
Priority: high Milestone: 1.5.6
Component: soap4r Version: 1.5
Keywords: Cc:

Description

from ruby-talk.

I am new to Ruby and am evaluating it for a project that would replace
and extend existing Perl code.  I am using wsdl2ruby to generate a
client stub with associated classes for a web service.  Most of the
basic calls more fine but the more complex method calls that take
parameter "anyType" do not work so well.  It appears that the type is
not getting set in the SOAP message generated by ruby.  However, the
perl code does allow me to set the type (manually  by calling
SOAP::Data -> type using SOAP::Lite).

Change History

09/09/06 10:28:38 changed by nahi

  • priority changed from normal to high.
  • milestone changed from undefined to 1.5.6.

from soap4r-ML

Hi all,
Hiroshi I see that you're back on this list, so I'll describe an issue that's been nagging me for adwords4r for a while:-)

In adwords4r I use wsdl2ruby to generate client bindings for the AdWords API.
For ReportService I still have an issue: https://adwords.google.com/api/adwords/v4/ReportService?wsdl
The generated driver looks like:

    module AdWords
    require 'adwords4r/v4/ReportService'

    require 'soap/rpc/driver'

    class ReportServiceInterface < ::SOAP::RPC::Driver
      DefaultEndpointUrl = " https://adwords.google.com/api/adwords/v4/ReportService"
      MappingRegistry = ::SOAP::Mapping::Registry.new

      Methods = [
        [ "",
          "scheduleReportJob",
          [ ["in", "parameters", ["::SOAP::SOAPElement", " https://adwords.google.com/api/adwords/v4", "scheduleReportJob"], true],
            ["out", "parameters", ["::SOAP::SOAPElement", " https://adwords.google.com/api/adwords/v4", "scheduleReportJobResponse"], true] ],
          { :request_style =>  :document, :request_use =>  :literal,
            :response_style => :document, :response_use => :literal }
        ],

In the WSDL KeywordsReportJob extends ReportJob
Which gives in the generated classes
# { https://adwords.google.com/api/adwords/v4}ReportJob
class ReportJob
  @@schema_type = "ReportJob"
  @@schema_ns = "https://adwords.google.com/api/adwords/v4 "
  @@schema_element = [
    ["aggregationType", "SOAP::SOAPString"],
    ["clientEmails", "SOAP::SOAPString[]"],
    ["crossClient", "SOAP::SOAPBoolean"],
    ["endDay", "SOAP::SOAPDate"],
    ["id", "SOAP::SOAPLong"],
    ["name", "SOAP::SOAPString"],
    ["startDay", "SOAP::SOAPDate"],
    ["status", "SOAP::SOAPString"]
  ]

  attr_accessor :aggregationType
  attr_accessor :clientEmails
  attr_accessor :crossClient
  attr_accessor :endDay
  attr_accessor :id
  attr_accessor :name
  attr_accessor :startDay
  attr_accessor :status

  def initialize(aggregationType = nil, clientEmails = [], crossClient = nil, endDay = nil, id = nil, name = nil, startDay = nil, status = nil)
    @aggregationType = aggregationType
    @clientEmails = clientEmails
    @crossClient = crossClient
    @endDay = endDay
    @id = id
    @name = name
    @startDay = startDay
    @status = status
  end
end

# {https://adwords.google.com/api/adwords/v4}KeywordReportJob
class KeywordReportJob
  @@schema_type = "KeywordReportJob"
  @@schema_ns = "https://adwords.google.com/api/adwords/v4"
  @@schema_element = [
    ["aggregationType", "SOAP::SOAPString"],
    ["clientEmails", "SOAP::SOAPString[]"],
    ["crossClient", "SOAP::SOAPBoolean"],
    ["endDay", "SOAP::SOAPDate"],
    ["id", "SOAP::SOAPLong"],
    ["name", "SOAP::SOAPString"],
    ["startDay", "SOAP::SOAPDate"],
    ["status", "SOAP::SOAPString"],
    ["adWordsType", "SOAP::SOAPString"],
    ["campaigns", "SOAP::SOAPInt[]"],
    ["keywordStatuses", "SOAP::SOAPString[]"],
    ["keywordType", "SOAP::SOAPString"],
    ["includeZeroImpression", "SOAP::SOAPBoolean"]
  ]

  attr_accessor :aggregationType
  attr_accessor :clientEmails
  attr_accessor :crossClient
  attr_accessor :endDay
  attr_accessor :id
  attr_accessor :name
  attr_accessor :startDay
  attr_accessor :status
  attr_accessor :adWordsType
  attr_accessor :campaigns
  attr_accessor :keywordStatuses
  attr_accessor :keywordType
  attr_accessor :includeZeroImpression

  def initialize(aggregationType = nil, clientEmails = [], crossClient = nil, endDay = nil, id = nil, name = nil, startDay = nil, status = nil, adWordsType = nil, campaigns = [], keywordStatuses = [], keywordType = nil, includeZeroImpression = nil)
    @aggregationType = aggregationType
    @clientEmails = clientEmails
    @crossClient = crossClient
    @endDay = endDay
    @id = id
    @name = name
    @startDay = startDay
    @status = status
    @adWordsType = adWordsType
    @campaigns = campaigns
    @keywordStatuses = keywordStatuses
    @keywordType = keywordType
    @includeZeroImpression = includeZeroImpression
  end
end


But when I use it
#!/usr/bin/env ruby

require 'adwords4r'
require 'open-uri'  

service = AdWords::API.new

job = AdWords::KeywordReportJob.new
job.aggregationType = AdWords::AggregationType::Summary
job.startDay = Date.new(2006,1,1)
job.endDay = Date.today
job.name = "Report1"

begin
    myJobId = service.scheduleReportJob(job)   
   
    status = service.getReportJobStatus (myJobId);

I get the following xml generated
    <scheduleReportJob xmlns="https://adwords.google.com/api/adwords/v3">
      <job>
        <aggregationType>Summary</aggregationType>
        <endDate>2006-05-25T15:57:43.7610170000000001-07:00</endDate>
        <name>Report1</name>
        <startDate>2006-04-25T15:57: 43.760927-07:00</startDate>
      </job>
    </scheduleReportJob>

Instead of
      <job xsi:type="KeywordReportJob">
        <aggregationType>Summary</aggregationType>
        <endDay>2006-05-25</endDay>
        <name>Report1</name>
        <startDay>2006-01-01</startDay>
      </job>

How do I get the xsi:type attribute in there?
Any help would be appreciated.

P@

-- 
Patrick Chanezon, Google API Evangelist
http://blog.chanezon.com/
http://www.google.com/apis/adwords/

09/09/06 10:51:38 changed by nahi

  • status changed from new to closed.
  • resolution set to fixed.

(In [1719]) dump xsi:type=... for typed SOAP node for document/literal service as same as for rpc/encoded service. SOAP node which is defined as an element does not include xsi:type (not changed). You can disable it with Driver#generate_explicit_type = false. closes #234.