EDIT:
Got too confusing with so many different edits, so this is where I’m currently at.
I have a HTTPService in my Flex 4 app defined as follows:
<s:HTTPService id="getUserDetails" url="http://localhost:3000/users/getDetails" method="GET"/>
I call this service like this (note: I’ve checked the network monitor in Flash Builder 4 and the userNameLookup variable is sent correctly):
var userNameLookup:String;
userNameLookup = calleeInput.text;
getUserDetails.send(userNameLookup);
And finally, this is the Ruby on Rails method:
def getDetails
@user = User.find_by_username(:userNameLookup)
render :xml => @user
end
This is the error message in the log:
Processing UsersController#getDetails
(for 127.0.0.1 at 2010-04-27 19:24:23)
[GET] User Load (0.2ms) SELECT *
FROM “users” WHERE (“users”.”username”
= ‘— :userNameLookup ‘) LIMIT 1ActionView::MissingTemplate (Missing
template users/getDetails.erb in view
path app/views):
app/controllers/users_controller.rb:33:in
getDetails'getDetails’
app/controllers/users_controller.rb:32:in
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in
service'run’
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in
/usr/local/lib/ruby/1.8/webrick/server.rb:173:in
start_thread'start’
/usr/local/lib/ruby/1.8/webrick/server.rb:162:in
/usr/local/lib/ruby/1.8/webrick/server.rb:162:in
start_thread'start’
/usr/local/lib/ruby/1.8/webrick/server.rb:95:in
/usr/local/lib/ruby/1.8/webrick/server.rb:92:in
each'start’
/usr/local/lib/ruby/1.8/webrick/server.rb:92:in
/usr/local/lib/ruby/1.8/webrick/server.rb:23:in
start'start’
/usr/local/lib/ruby/1.8/webrick/server.rb:82:in
So it appears that the userNameLookup parameter isn’t being referred to correctly?
Just a thought, but does it matter that I’ve set the HTTPService to GET even though it is posting something?
The controller action methods should be implemented without parameters. The parameters can be inferred from the request parameters.
Try this:
In the code above I have used
lookupUsernameas the query parameter. Change that to the actual name sent by your flex client.Edit 1
You need explicit xml format handler to return the result as XML. Apart from this, it looks like
lookupUsernameparameter is empty in your invocations. Is it possible that the query parameter is named something else? You can get the name of the query parameter by looking at the log file. Your log file should show an entry like this: