Forum: Ruby on Rails SOAP Client Connections

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Drew B. (Guest)
on 2005-12-25 08:14
(Received via mailing list)
I'm trying to connect to a SOAP interface using Rails and I'm running
into a snag. I'm relatively new to Rails at this point and am in the
very beginning stages of understanding how the system works. Currently
I'm running into a error that looks like this:

--------------------------------------------
Missing API definition file in apis/amazon_api.rb
--------------------------------------------

Now, the main issue here is that this file does exist in the app/apis
directory, but it looks almost as if it is looking for it relative to
the base directory. The reason I say this is that later on in the error
screen I get this:

--------------------------------------------
|This error occured while loading the following files:
./script/../config/../app/controllers/store_controller.rb
|amazon|_api.rb
|--------------------------------------------

This leads me to believe that the first file is being called relative to
that directory, but the second is being called from inside the base
directory. Now my question is, could it be possible that the
environmental variable for the location of the APIs is messed up some
how? If so, how can I fix this?

Forgive me, I am very new to this whole language and am still getting
used to the structure of things. I'm hoping that this is an easy fix.

Also, if anyone has any pointers on setting up a SOAP interface to pull
down data, that would be great. Currently I'm trying to port an
application from PHP to Rails (for purely educational reasons) and can't
seem to get past this hump.

Here's my controller definition:

--------------------------------------------
class StoreController < ApplicationController
   web_client_api :amazon,
                :soap,

"http://webservices.amazon.com/AWSECommerceService/...,

                {:Service => 'AWSECommerceService'}
  def index

  end
end
--------------------------------------------

I know its bare, but I haven't been able to get past the error screen
from before to start fleshing thing out. Here's the API file:

--------------------------------------------
class AmazonApi < ActionWebService::API::Base
  api_method :find
end
--------------------------------------------

That's about all I have. I've been tearing out my hair for hours.

Thanks in advance for any help that anyone can offer. Please, let me
know if I'm close or if I'm way off base.

~Drew
eduard (Guest)
on 2005-12-26 05:14
(Received via mailing list)
Check http://dev.ctor.org/soap4r/

The package contains several examples, one of them is how to connect to
Amazon.

eduard
Drew B. (Guest)
on 2005-12-26 09:20
(Received via mailing list)
Eduard,

Thanks for the link. Just to be sure we're clear, Amazon is not my real
focus here. In fact I'm really looking for a solution to use SOAP with
rails
to develop an application interface with an entirely separate
application, I
just thought it would be best to learn SOAP with Ruby using a SOAP
interface
I was familiar with. I'll definitely look into SOAP4R as from my
research,
there appears to be some pretty serious deficiencies with AWS's SOAP
interface (as in it does not have the full W3C specification).

My main concern with this now is no longer SOAP, but with the fact that
the
API directory is not mapping correctly. Not sure if this is a bug with
the
1.0.0 release or if I did something wrong with my initial setup (not
that
there is a whole lot of configuration involved with Rails).

Any ideas about what might be causing this or of a fix I might apply
that
would resolve this issue would be great. I may end up hacking the GEM
just
to get this working, Though as I'm new to Ruby, it may take a little
while.

Thanks for your help. I'll definitely be looking into SOAP4R, as it does
appear to be the SOAP solution of choice.

~Drew
This topic is locked and can not be replied to.