I''m building a users web service (direct dispatching) that will (I hope) allow several other applications to manage the same pool of users. Plus it will act as a single-sign-on solution for what I''m doing. But I''m having difficulty accessing the UserAPI. Here''s what I''ve done so far: $> rails usermanagement - "usermanagement" is the application that will have an API to allow other applications to manage the user base (register, edit, login, authenticate, etc). Within usermanagement, I have: 1) models/user.rb 2) controllers/user_controller.rb 3) apis/user_api.rb 1) Model: User.rb - This file just holds some business logic for maintaining the users. 2) Controller: class UserController < ApplicationController and below this line at the top of the file, I have: wsdl_service_name ''User'' web_service_api UserApi then my method implementations. 3) ApiDefinition: UserApi.rb - this file has all of my "api_method" calls and details what methods expect and return. Now, that''s how I''m setup, and I''ve tested all of this and followed the AWDWRv2 book. My problem is trying to access these methods from a completely new application, so continuing: $> rails newapplication - "newapplication" will be one of the many applications that must use the users web service to register and login, etc. How can I access these methods? Here''s what I''m trying (with no luck): 1) In: class SomeController < ApplicationController I have, web_client_api :user, :xmlrpc, "http://localhost:3000/user/api/RPC2", :handler_name => "user_api" And I try using things like "user_api.authenticate(un,pw)" etc. Doesn''t work, I''m currently getting: "Missing API definition file in apis/user_api.rb" but surely you don''t have to include the file from the other service from within each application, right? Because then I would have to have a User.rb model in every case as well? 2) In: class SomeController < ApplicationController I''ve tried, user_api = ActionWebService::Client::XmlRpc.new(UserApi, "http://localhost:3000/user/api/RPC2") And tried accessing things like "user_api.authenticate(un,pw)" etc. That doesn''t work, either. I got the following errors: "uninitialized constant UserApi" when trying to open the file "user_api.rb". I don''t know how to fix this. Actually, I don''t know how to access my methods in the "usermanagement" service from any of my other services. Can someone explain that to me? See anything wrong with what I''ve tried? And sorry this is so long, but I want to include as much information as possible. Thanks a lot for any help. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi, my recommendation is to the following: a) invoke and verify that your external webservice using script/console user_api = ActionWebService::Client::XmlRpc.new(UserApi, "http://localhost:3000/user/api/RPC2" b) If (a) is working as expected, then you should read and follow the information in 25.7 of AWDwRv2. If not, then you should follow an incremental development approach to correct the code: code A test A debug A code A test A debug A and so on. You may not need to debug in every case and you''ll continue this process until you have completed the implementation. Why do it this way? It seems that you have implemented alot of code without testing it until the very end. Also, I have don''t have time to do it for you and this is something that you need to learn. Good luck, -Conrad On 1/18/07, rph <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > I''m building a users web service (direct dispatching) that will (I hope) > allow several other applications to manage the same pool of users. Plus > it will act as a single-sign-on solution for what I''m doing. But I''m > having difficulty accessing the UserAPI. Here''s what I''ve done so far: > > $> rails usermanagement > > - "usermanagement" is the application that will have an API to allow > other applications to manage the user base (register, edit, login, > authenticate, etc). > > Within usermanagement, I have: > 1) models/user.rb > 2) controllers/user_controller.rb > 3) apis/user_api.rb > > 1) Model: User.rb - This file just holds some business logic for > maintaining the users. > > 2) Controller: class UserController < ApplicationController and below > this line at the top of the file, I have: > > wsdl_service_name ''User'' > web_service_api UserApi > > then my method implementations. > > 3) ApiDefinition: UserApi.rb - this file has all of my "api_method" > calls and details what methods expect and return. > > Now, that''s how I''m setup, and I''ve tested all of this and followed the > AWDWRv2 book. My problem is trying to access these methods from a > completely new application, so continuing: > > $> rails newapplication > > - "newapplication" will be one of the many applications that must use > the users web service to register and login, etc. How can I access > these methods? Here''s what I''m trying (with no luck): > > 1) In: class SomeController < ApplicationController I have, > web_client_api :user, :xmlrpc, "http://localhost:3000/user/api/RPC2", > :handler_name => "user_api" > > And I try using things like "user_api.authenticate(un,pw)" etc. Doesn''t > work, I''m currently getting: > > "Missing API definition file in apis/user_api.rb" but surely you don''t > have to include the file from the other service from within each > application, right? Because then I would have to have a User.rb model > in every case as well? > > 2) In: class SomeController < ApplicationController I''ve tried, > user_api = ActionWebService::Client::XmlRpc.new(UserApi, > "http://localhost:3000/user/api/RPC2") > > And tried accessing things like "user_api.authenticate(un,pw)" etc. > That doesn''t work, either. I got the following errors: > > "uninitialized constant UserApi" when trying to open the file > "user_api.rb". I don''t know how to fix this. > > Actually, I don''t know how to access my methods in the "usermanagement" > service from any of my other services. Can someone explain that to me? > See anything wrong with what I''ve tried? And sorry this is so long, but > I want to include as much information as possible. Thanks a lot for any > help. > > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 1/18/07, Conrad Taylor <conradwt-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hi, my recommendation is to the following: > > a) invoke and verify that your external webservice using script/console > > user_api = ActionWebService::Client::XmlRpc.new(UserApi, > "http://localhost:3000/user/api/RPC2" > > b) If (a) is working as expected, then you should read and follow the > information > in 25.7 of AWDwRv2. > > If not, then you should follow an incremental development > approach to correct > the code: > > code A > test A > debug A > code A > test A > debug A > and so on. > > You may not need to debug in every case and you''ll continue this process > until you have completed the implementation. Why do it this way? It seems > that you have implemented alot of code without testing it until > the very end. > Also, I have don''t have time to do it for you and this is > something that you need > to learn. > > Good luck, > > -Conrad > > > On 1/18/07, rph <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > > > > I''m building a users web service (direct dispatching) that will (I hope) > > allow several other applications to manage the same pool of users. Plus > > it will act as a single-sign-on solution for what I''m doing. But I''m > > having difficulty accessing the UserAPI. Here''s what I''ve done so far: > > > > $> rails usermanagement > > > > - "usermanagement" is the application that will have an API to allow > > other applications to manage the user base (register, edit, login, > > authenticate, etc). > > > > Within usermanagement, I have: > > 1) models/user.rb > > 2) controllers/user_controller.rb > > 3) apis/user_api.rb > > > > 1) Model: User.rb - This file just holds some business logic for > > maintaining the users. > > > > 2) Controller: class UserController < ApplicationController and below > > this line at the top of the file, I have: > > > > wsdl_service_name ''User'' > > web_service_api UserApi > > > > then my method implementations. > > > > 3) ApiDefinition: UserApi.rb - this file has all of my "api_method" > > calls and details what methods expect and return. > > > > Now, that''s how I''m setup, and I''ve tested all of this and followed the > > AWDWRv2 book. My problem is trying to access these methods from a > > completely new application, so continuing: > > > > $> rails newapplication > > > > - "newapplication" will be one of the many applications that must use > > the users web service to register and login, etc. How can I access > > these methods? Here''s what I''m trying (with no luck): > > > > 1) In: class SomeController < ApplicationController I have, > > web_client_api :user, :xmlrpc, "http://localhost:3000/user/api/RPC2", > > :handler_name => "user_api" > > > > And I try using things like "user_api.authenticate(un,pw)" etc. Doesn''t > > work, I''m currently getting: > > > > "Missing API definition file in apis/user_api.rb" but surely you don''t > > have to include the file from the other service from within each > > application, right? Because then I would have to have a User.rb model > > in every case as well? > > > > 2) In: class SomeController < ApplicationController I''ve tried, > > user_api = ActionWebService::Client::XmlRpc.new(UserApi, > > "http://localhost:3000/user/api/RPC2") > > > > And tried accessing things like "user_api.authenticate(un,pw)" etc. > > That doesn''t work, either. I got the following errors: > > > > "uninitialized constant UserApi" when trying to open the file > > "user_api.rb". I don''t know how to fix this. > > > > Actually, I don''t know how to access my methods in the "usermanagement" > > service from any of my other services. Can someone explain that to me? > > See anything wrong with what I''ve tried? And sorry this is so long, but > > I want to include as much information as possible. Thanks a lot for any > > help. > > > > -- > > Posted via http://www.ruby-forum.com/. > > > > > > > > > > >Hi, You might also try hitting it with curl: curl -H "Content-Type: text/xml" -H "SoapAction: authenticate" -d @msg -X POST http://localhost:3000/user/api where @msg is a file with the SOAP or xml message. I have experience more on the server side of exposing web services from a rails controller, not so much in consuming services using ActionWebService::Client. If all the applications will be rails consider activeresource instead of AWS. Good luck. -- Zack Chandler http://depixelate.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---