Dashboard > ChannelAdvisor Developer Network > ... > Code Samples > Ruby SOAP4R CA proxy generator
Log In   View a printable version of the current page.
Ruby SOAP4R CA proxy generator
Added by Greg Smith, last edited by Greg Smith on Mar 25, 2008  (view change)
Labels: 
(None)


Many thanks to Jim Wilson of Aspyro for submitting this Ruby sample.  The zip file contains all the code you need to run this.  

How To: Get started with Ruby/SOAP4R and the ChannelAdvisor web services
\-----------------------------------------------------------------------\-
This "How To" shows you how to create Ruby classes for each of the CA
web services using a Rakefile task.

Install
\-----\-
Make sure you have Rake and SOAP4R installed. I used soap4r 1.5.8.
 >gem install rake
 >gem install soap4r
 # verify by examining local gems
 >gem list \--local 

Generate classes
\---------------\-
I prefer to have the web services within their own module, to avoid
name clashes with other classes. This is done by setting the
ROOT_MODULE value. The default value is CAWS. The provided Rakefile
will produce all classes for all services within this module using wsdl2ruby.

 >rake
ignored element:
{http://schemas.xmlsoap.org/wsdl/soap12/}
binding
ignored element:
{http://schemas.xmlsoap.org/wsdl/soap12/}
operation
ignored element:
{http://schemas.xmlsoap.org/wsdl/soap12/}
body
ignored element:
{http://schemas.xmlsoap.org/wsdl/soap12/}
header
ignored element:
{http://schemas.xmlsoap.org/wsdl/soap12/}
address
I, \[2008-03-13T08:51:22.726232 #20457\]  INFO \-\- app: Creating class definition.
I, \[2008-03-13T08:51:22.726475 #20457\]  INFO \-\- app: Creates file 'Cart.rb'.
I, \[2008-03-13T08:51:22.777090 #20457\]  INFO \-\- app: Creating mapping registry definition.
I, \[2008-03-13T08:51:22.777282 #20457\]  INFO \-\- app: Creates file 'CartMappingRegistry.rb'.
I, \[2008-03-13T08:51:22.855710 #20457\]  INFO \-\- app: Creating driver.
I, \[2008-03-13T08:51:22.855922 #20457\]  INFO \-\- app: Creates file 'CartDriver.rb'.
I, \[2008-03-13T08:51:22.863672 #20457\]  INFO \-\- app: Creating client skelton.
I, \[2008-03-13T08:51:22.863882 #20457\]  INFO \-\- app: Creates file 'CartServiceClient.rb'.
I, \[2008-03-13T08:51:22.870153 #20457\]  INFO \-\- app: End of app. (status: 0)
ignored element:
{http://schemas.xmlsoap.org/wsdl/soap12/}
binding
ignored element:
{http://schemas.xmlsoap.org/wsdl/soap12/}
operation
ignored element:
{http://schemas.xmlsoap.org/wsdl/soap12/}
body
ignored element:
{http://schemas.xmlsoap.org/wsdl/soap12/}
header
ignored element:
{http://schemas.xmlsoap.org/wsdl/soap12/}
address
I, \[2008-03-13T08:51:23.645155 #20459\]  INFO \-\- app: Creating class definition.
....
\\

\[Ignore the "ignored element". Not sure where it is from but when I researched on
web, it appears to be typical. Perhaps a guru can explain better...\]

Credentials
\----------\-
Note that the provided class credentials_handler.rb inserts the
necessary authentication values for each request.

Test it out
\----------\-
Edit the ping_sample.rb to insert your id and password, then run it.
 >ruby ping_sample.rb
 OK - Success

\--\-
HTH
Jim Wilson
March 2008
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.1 Build:#806 May 06, 2007) - Bug/feature request - Contact Administrators