Deal of the Day

Home » Main » Manning Forums » 2007 » Flexible Rails

Thread: RPC Fault faultString="HTTP request error"...

Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 23 - Pages: 2 [ 1 2 | Next ] - Last Post: Jun 5, 2008 7:53 PM by: sillydave
hhorstman

Posts: 1
From: The Netherlands
Registered: 11/16/07
RPC Fault faultString="HTTP request error"...
Posted: Nov 16, 2007 8:34 AM
  Click to reply to this thread Reply

I'm currently trying to understand the examples in Iteration 3 of the book. On submit the following error appears:

[RPC Fault faultString="HTTP request error" faultCode="Server.Error.Request" faultDetail="Error: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: /sessions/create_xml"]. URL: /sessions/create_xml"]
at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::faultHandler()[E:\dev\flex_3_beta2\sdk\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:211]
at mx.rpc::Responder/fault()[E:\dev\flex_3_beta2\sdk\frameworks\projects\rpc\src\mx\rpc\Responder.as:56]
at mx.rpc::AsyncRequest/fault()[E:\dev\flex_3_beta2\sdk\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:110]
at DirectHTTPMessageResponder/errorHandler()[E:\dev\flex_3_beta2\sdk\frameworks\projects\rpc\src\mx\messaging\channels\DirectHTTPChannel.as:343]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/redirectEvent()

What am I doing wrong?

peterarmstrong

Posts: 94
From: Vancouver, BC
Registered: 11/10/07
Re: RPC Fault faultString="HTTP request error"...
Posted: Nov 17, 2007 12:22 AM   in response to: hhorstman in response to: hhorstman
  Click to reply to this thread Reply

It's really hard to tell from this trace; are you using the Rails 2 release candidate (1.99.0) or Rails 1.2.x?

Does the example from iteration 3 at http://www.flexiblerails.com/code-samples (the first link, i.e. http://www.flexiblerails.com/files/code.zip) work for you?

(First download and unzip the code, then run newdb.bat in the iteration03 folder (or convert it to the equivalent shell script if you're on OS X), then do a clean build.)

Some people have had issues where the earlier prerelease of Rails 2 (1.2.3.7707) have been not used, since they had a higher version (e.g. 1.2.5) installed. Since the release candidate is 1.99.0 this shouldn't happen anymore...

NBean

Posts: 5
Registered: 12/21/07
Re: RPC Fault faultString="HTTP request error"...
Posted: Dec 21, 2007 11:07 PM   in response to: peterarmstrong in response to: peterarmstrong
  Click to reply to this thread Reply

I'm having a similar issue on page 187 with updating the datagrid.
using Rails 1.99.0, getting the following flex error:

[RPC Fault faultString="HTTP request error" faultCode="Server.Error.Request" faultDetail="Error: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: http://localhost:3000/tasks.xml"]. URL: /tasks.xml"]
at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::faultHandler()[E:\dev\flex_3_beta3\sdk\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:223]
at mx.rpc::Responder/fault()[E:\dev\flex_3_beta3\sdk\frameworks\projects\rpc\src\mx\rpc\Responder.as:56]
at mx.rpc::AsyncRequest/fault()[E:\dev\flex_3_beta3\sdk\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:110]
at DirectHTTPMessageResponder/errorHandler()[E:\dev\flex_3_beta3\sdk\frameworks\projects\rpc\src\mx\messaging\channels\DirectHTTPChannel.as:349]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/redirectEvent()

The tasks is created in mySQL, but I get this error.
I get no error if I change the :status to 200, in the create method for the task_controller as so:

# POST /tasks
# POST /tasks.xml
def create
@task = current_user.tasks.build(params[:task])
respond_to do |format|
if @task.save
format.html do
flash[:notice] = 'Task was successfully created.'
redirect_to(@task)
end
#format.xml { render :xml => @task, :status => :created, :location => @task }
format.xml { render :xml => @task , :status => 200 , :location => @task }
else
format.html { render :action => "new" }
format.xml { render :xml => @task.errors,
:status => :unprocessable_entity }
end
end
end

No error, but now the datagrid in flex goes blank.

I added a button to run listTasks() and this will populate the datagrid with tasks, including the one just created.
<mx:Button id="debugUpdate" label="Get list" height="30" click="listTasks()" />

Any thoughts on what I've done wrong?

using Windows with Flex Builder 3

Thanks.....

NBean

Posts: 5
Registered: 12/21/07
Re: RPC Fault faultString="HTTP request error"...
Posted: Dec 22, 2007 9:40 AM   in response to: NBean in response to: NBean
  Click to reply to this thread Reply

Update: I was using IE7 when this was occurring. There is no issue when using Firefox 2. Any idea why? I tried it on two PCs, on one that I hadn't loaded the page and still the same issue (with IE7).

Thanks for the help.

peterarmstrong

Posts: 94
From: Vancouver, BC
Registered: 11/10/07
Re: RPC Fault faultString="HTTP request error"...
Posted: Dec 22, 2007 12:04 PM   in response to: NBean in response to: NBean
  Click to reply to this thread Reply

I've heard of one other case of something similar somewhere else -- I think it may have to do with Rails caching or something... I haven't reproduced it myself, so I'm not sure...

Mhason

Posts: 2
From: Howard
Registered: 1/4/08
Re: RPC Fault faultString="HTTP request error"...
Posted: Jan 4, 2008 9:50 PM   in response to: hhorstman in response to: hhorstman
  Click to reply to this thread Reply

I am totally stuck, I have tried opening several different iterations and receive the same result:

[RPC Fault faultString="HTTP request error" faultCode="Server.Error.Request" faultDetail="Error: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: http://localhost:3000/users/create.xml"]. URL: /users/create.xml"]
at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::faultHandler()[E:\dev\flex_3_beta3\sdk\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:223]
at mx.rpc::Responder/fault()[E:\dev\flex_3_beta3\sdk\frameworks\projects\rpc\src\mx\rpc\Responder.as:56]
at mx.rpc::AsyncRequest/fault()[E:\dev\flex_3_beta3\sdk\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:110]
at DirectHTTPMessageResponder/errorHandler()[E:\dev\flex_3_beta3\sdk\frameworks\projects\rpc\src\mx\messaging\channels\DirectHTTPChannel.as:349]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/redirectEvent()

I had initially installed rails 2.0.2 but I have reverted to the version you use in the book and get the same result. I have also tried using mongrel. Please let me know what I am doing wrong, or what I can post to help define the problem details more clearly. WEBrick throws out a 404 error and mongrel gives the following (After much else...) Rendering c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.99.0/lib/action_controller/templates/rescues/layout.erb (not_found)

I am new to web programming but have learned a lot from your book so far. Thanks for all of your hard work!

peterarmstrong

Posts: 94
From: Vancouver, BC
Registered: 11/10/07
Re: RPC Fault faultString="HTTP request error"...
Posted: Jan 5, 2008 1:26 AM   in response to: Mhason in response to: Mhason
  Click to reply to this thread Reply

If it is doing

"Rendering c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.99.0/lib/action_controller/templates/rescues/layout.erb (not_found)"

it means that it's responding to some error and then not finding the template for the response, I think. So, something is going wrong on the Rails side (possibly in response to bad input) before the actual rendering.

Can you try the following: Download the code zip file, and pick the specific completed iteration that matches what you're trying to debug. In Flex Builder, do a clean build. Recreate your database with newdb.bat (or newdb.sh) and then restart your server. After all this, test the app in Firefox, not IE.

If this works for you, then you can start systematically varying things until you can reproduce the bug.

Note: take a look at this thread (http://www.manning-sandbox.com/thread.jspa?threadID=22265&tstart=0) for something that might help.

Thanks,
Peter

mmanojr

Posts: 1
Registered: 1/6/08
Re: RPC Fault faultString="HTTP request error"...
Posted: Jan 6, 2008 1:27 PM   in response to: Mhason in response to: Mhason
  Click to reply to this thread Reply

I had the same issue. And when i closely looked at the error Rails was throwing, I identified a mistake in the xml tag. <first_name> was spelled as <fist_name>. So I suggest look closely at the error rails is throwing, you may find your problem

peterarmstrong

Posts: 94
From: Vancouver, BC
Registered: 11/10/07
Re: RPC Fault faultString="HTTP request error"...
Posted: Jan 6, 2008 2:26 PM   in response to: mmanojr in response to: mmanojr
  Click to reply to this thread Reply

Yeah, I've had similar experiences where I've done something like that in Rails and been initially confused about what the heck is going on. The development.log file is your friend.

The nice thing about the code zip file is that it's a good last/resort sanity check. If you cannot find the problem, you can run the relevant completed iteration. If it works for you, then you have the reassurance of knowing that the answer lies in the diff between what you have done and what it is. If it *doesn't* work, then you have an issue with your environment since it worked for me (and hundreds of other people). So, it's a good quick check, to at least know if you have a code or environment issue...

dfwgator

Posts: 6
Registered: 12/7/03
Re: RPC Fault faultString="HTTP request error"...
Posted: Jan 8, 2008 1:05 PM   in response to: NBean in response to: NBean
  Click to reply to this thread Reply

I am getting the same exact thing. Any ideas.

The one thing I noticed is that while it appears to work in Firefox, the status bar says "Transferring data from localhost..." even after the grid is updated, and it never gets cleared.

NBean

Posts: 5
Registered: 12/21/07
Re: RPC Fault faultString="HTTP request error"...
Posted: Jan 8, 2008 4:14 PM   in response to: dfwgator in response to: dfwgator
  Click to reply to this thread Reply

When I installed ruby and rails on another Windows machine (It was the same ruby installer and rails version), I had no issues with running the application in IE. Not sure what that means.

dfwgator

Posts: 6
Registered: 12/7/03
Re: RPC Fault faultString="HTTP request error"...
Posted: Jan 11, 2008 10:52 AM   in response to: NBean in response to: NBean
  Click to reply to this thread Reply

I got it to work in IE by changing the return status to 301. It updated the grid just fine. So the issue definately appears to be it handling the status code of 201.

peterarmstrong

Posts: 94
From: Vancouver, BC
Registered: 11/10/07
Re: RPC Fault faultString="HTTP request error"...
Posted: Jan 11, 2008 12:38 PM   in response to: dfwgator in response to: dfwgator
  Click to reply to this thread Reply

Argh, this will teach me for trying to be "better" and using status codes; I should have just used 200 OK throughout.

Oh well, I'm really glad you tracked this down.

Thanks,
Peter

dfwgator

Posts: 6
Registered: 12/7/03
Re: RPC Fault faultString="HTTP request error"...
Posted: Jan 11, 2008 10:18 PM   in response to: peterarmstrong in response to: peterarmstrong
  Click to reply to this thread Reply

That's just it, when I tried to use 200, as another poster noted, it wiped out all the data in the grid, I have to use either 301 or 302 to get it to work properly.

moose

Posts: 2
Registered: 3/15/08
Re: RPC Fault faultString="HTTP request error"...
Posted: Mar 15, 2008 11:58 AM   in response to: dfwgator in response to: dfwgator
  Click to reply to this thread Reply

The problem is that explorer sux and is caching the second request. Even though the first is a POST and the second is a GET the results of the 1st request are being used for the second and since there isn't a list with children there is no data for the list to display.

To prove this look at the server output. When adding a task you see the post for the add, but no get for the list. If you debug the app and break on the request handler you see the data returned from the post. If you break before the request it all works because explorer times out while the debugger is paused. If you change the request for the list to /tasks.xml?explorer-sux then it all works because the two back to back requests do not appear the same to IE.

This would seem to be a glaring problem for using REST with IE. Anyone know a fix that is generally applicable.

Legend
Gold: 300 + pts
Silver: 100 - 299 pts
Bronze: 25 - 99 pts
Manning Author
Manning Staff