[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Problem with SOAP and Commision Junction web services

Chris Mohr

10/6/2006 9:18:00 PM

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...
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-....

3 Answers

eden li

10/7/2006 4:12:00 AM

0

> 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/ht....

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.


Chris Mohr

10/7/2006 8:13:00 AM

0

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-....

eden li

10/7/2006 8:59:00 AM

0

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