Problem with SOAP and Commision Junction web services

Discussion in 'Ruby' started by Chris Mohr, Oct 6, 2006.

  1. Chris Mohr

    Chris Mohr Guest

    I'm new to Ruby and Web Services.

    I'm trying to use Commision Junction's Web services.

    I've run a couple example web services with Ruby, so I'm confidents that
    my env is setup properly. I've also connected to the CJ webservice using
    PERL, so the service is working fine.

    Here is my code:

    require 'soap/wsdlDriver'
    wsdl = 'http://api.cj.com/wsdl/productSearchService.wsdl'
    driver = SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver

    Here is a warning that I get:

    ignored attr: {}nillable

    I'm not sure what this means...I'm assuming that the wsdl isn't being
    read correctly.

    If I ignore that, and continue, here is what I get.

    developerKey = 'my actual developer key'
    websiteId = a website id number
    keywords ="test keyword"
    result = driver.search(developerKey, websiteId, '', keywords, '', '',
    '', '', '', '', '', '', '', 0, 3)

    Console output:

    ignored attr: {}nillable
    /usr/local/lib/ruby/1.8/soap/rpc/driver.rb:230:in `search': wrong number
    of arguments (15 for 1) (ArgumentError)

    Following that, I tried:

    param = { 'developerKey' => 'my key',
    'websiteId' => 'my website id',
    'advertiserIds' => '',
    'keywords' => 'test',
    'serviceableArea' => '',
    'upcOrIsbnOrEan' => '',
    'manufacturerName' =>'',
    'advertiserSku' => '',
    'lowPrice' => '',
    'highPrice' => '',
    'currency' => '',
    'sortBy' => '',
    'orderIn' => '',
    'startAt' => 0,
    'maxResults' => 3 }

    result = driver.search(param)

    Booyah...I got past the number of params error, but still no luck

    ignored attr: {}nillable
    warning: peer certificate won't be verified in this SSL session
    #<SOAP::Mapping::Object:0x1047ffc>: no SOAPAction header!
    (SOAP::FaultError)

    So I got the feeling that this all has something to do with the:

    ignored attr: {}nillable

    But I'm not sure how to troubleshoot further.

    Any ideas?

    --
    Posted via http://www.ruby-forum.com/.
    Chris Mohr, Oct 6, 2006
    #1
    1. Advertising

  2. Chris Mohr

    eden Guest

    > ignored attr: {}nillable

    Never seen this before, it seems safe to ignore this... for now.

    > warning: peer certificate won't be verified in this SSL session
    > #<SOAP::Mapping::Object:0x1047ffc>: no SOAPAction header!
    > (SOAP::FaultError)


    You should install the latest version of http-access2. The default
    HTTP driver that soap4r uses munges the "SOAPAction" header into
    "Soapaction" which Commission Junction's Java SOAP implementation
    doesn't like. http-access2 preserves the header properly.

    You can get it here: http://dev.ctor.org/http-access2.

    After you install http-access2 you need to tell it to ignore the self
    signed certificate by adding the following line of code.

    driver.options["protocol.http.ssl_config.verify_mode"] = nil

    As a next step, I recommend using wsdl2ruby to generate the stub
    classes off the WSDL definitions. Everytime you call
    SOAP::WsdlDriverFactory.new(), you're adding the overhead of
    downloading the wsdl definitions for every search call (unless balance
    the amount of ws calls you make against the number of driver instances
    you have by caching them and keeping your ruby process alive or
    somesuch).

    If you use wsdl2ruby, you'll likely not see the nillable warning
    anymore.
    eden, Oct 7, 2006
    #2
    1. Advertising

  3. Chris Mohr

    Chris Mohr Guest

    Thank you for the very detailed reply...it helped a lot.

    By installing the latest version of http-access2 and setting the verify
    mode, I was able to connect to the service successfully.

    I'm now experimenting with wsdl2ruby, and struggling a bit. I did still
    get the nillable warning when I ran wsdl2ruby, so it must not like the
    nillable attribute in the CJ wsdl file. It doesn't seem like problem so
    far though. I am getting the same verification error as before now, so I
    just need to figure out how to set that option, using the object created
    by wsdl2ruby.

    Thanks again.

    --
    Posted via http://www.ruby-forum.com/.
    Chris Mohr, Oct 7, 2006
    #3
  4. Chris Mohr

    eden li Guest

    Hrm. That's strange. I've been using CJ without that warning for
    awhile. I don't think that this is an issue with CJ. I did upgrade to
    the latest tarball of soap4r, so maybe that will solve things?

    What version of ruby are you running on? What does:

    ruby -r soap/rpc/driver -e 'puts SOAP::Version'

    say?

    Chris Mohr wrote:
    > I'm now experimenting with wsdl2ruby, and struggling a bit. I did still
    > get the nillable warning when I ran wsdl2ruby, so it must not like the
    > nillable attribute in the CJ wsdl file
    eden li, Oct 7, 2006
    #4
    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. jbj
    Replies:
    1
    Views:
    318
    John Fereira
    Jul 31, 2004
  2. Guest
    Replies:
    0
    Views:
    475
    Guest
    Mar 9, 2005
  3. Jaroslaw Zabiello

    ZSI, SOAP and .NET web services - problem

    Jaroslaw Zabiello, Mar 22, 2007, in forum: Python
    Replies:
    9
    Views:
    2,166
    Ravi Teja
    Mar 27, 2007
  4. John
    Replies:
    4
    Views:
    442
  5. B. Deepak

    soap using remoting vs soap using web services

    B. Deepak, Jun 20, 2006, in forum: ASP .Net Web Services
    Replies:
    2
    Views:
    194
Loading...

Share This Page