hhorstman (1) [Avatar] Offline
#1
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:devflex_3_beta2sdkframeworksprojects pcsrcmx pcAbstractInvoker.as:211]
at mx.rpc::Responder/fault()[E:devflex_3_beta2sdkframeworksprojects pcsrcmx pcResponder.as:56]
at mx.rpc::AsyncRequest/fault()[E:devflex_3_beta2sdkframeworksprojects pcsrcmx pcAsyncRequest.as:110]
at DirectHTTPMessageResponder/errorHandler()[E:devflex_3_beta2sdkframeworksprojects pcsrcmxmessagingchannelsDirectHTTPChannel.as:343]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/redirectEvent()

What am I doing wrong?
peterarmstrong (94) [Avatar] Offline
#2
Re: RPC Fault faultString="HTTP request error"...
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 (6) [Avatar] Offline
#3
Re: RPC Fault faultString="HTTP request error"...
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:devflex_3_beta3sdkframeworksprojects pcsrcmx pcAbstractInvoker.as:223]
at mx.rpc::Responder/fault()[E:devflex_3_beta3sdkframeworksprojects pcsrcmx pcResponder.as:56]
at mx.rpc::AsyncRequest/fault()[E:devflex_3_beta3sdkframeworksprojects pcsrcmx pcAsyncRequest.as:110]
at DirectHTTPMessageResponder/errorHandler()[E:devflex_3_beta3sdkframeworksprojects pcsrcmxmessagingchannelsDirectHTTPChannel.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 smilieml => @task, :status => :created, :location => @task }
format.xml { render smilieml => @task , :status => 200 , :location => @task }
else
format.html { render :action => "new" }
format.xml { render smilieml => @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 (6) [Avatar] Offline
#4
Re: RPC Fault faultString="HTTP request error"...
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 (94) [Avatar] Offline
#5
Re: RPC Fault faultString="HTTP request error"...
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 (2) [Avatar] Offline
#6
Re: RPC Fault faultString="HTTP request error"...
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:devflex_3_beta3sdkframeworksprojects pcsrcmx pcAbstractInvoker.as:223]
at mx.rpc::Responder/fault()[E:devflex_3_beta3sdkframeworksprojects pcsrcmx pcResponder.as:56]
at mx.rpc::AsyncRequest/fault()[E:devflex_3_beta3sdkframeworksprojects pcsrcmx pcAsyncRequest.as:110]
at DirectHTTPMessageResponder/errorHandler()[E:devflex_3_beta3sdkframeworksprojects pcsrcmxmessagingchannelsDirectHTTPChannel.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 (94) [Avatar] Offline
#7
Re: RPC Fault faultString="HTTP request error"...
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 (1) [Avatar] Offline
#8
Re: RPC Fault faultString="HTTP request error"...
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 (94) [Avatar] Offline
#9
Re: RPC Fault faultString="HTTP request error"...
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 (6) [Avatar] Offline
#10
Re: RPC Fault faultString="HTTP request error"...
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 (6) [Avatar] Offline
#11
Re: RPC Fault faultString="HTTP request error"...
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 (6) [Avatar] Offline
#12
Re: RPC Fault faultString="HTTP request error"...
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 (94) [Avatar] Offline
#13
Re: RPC Fault faultString="HTTP request error"...
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 (6) [Avatar] Offline
#14
Re: RPC Fault faultString="HTTP request error"...
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 (2) [Avatar] Offline
#15
Re: RPC Fault faultString="HTTP request error"...
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.
peterarmstrong (94) [Avatar] Offline
#16
Re: RPC Fault faultString="HTTP request error"...
Since all the stuff in the finished Pomodo app in Flexible Rails goes through ServiceUtils, I could see writing a cheesy query string generator thing in there to beat the caching. At least then the hacking is is one place...
moose (2) [Avatar] Offline
#17
Re: RPC Fault faultString="HTTP request error"...
Forgot to mention that this is why the 301 response works. Explorer sees the redirect and for some reason goes ahead and sends the second request. It is the 200 response that kills you. However using a redirect seems like a bad choice if you want your rails api to be consistent. Not being able to use 201 for a create is bad enough.

I'm hoping someone has a better suggestion than appending a random string to the end of the POST url. So far that is the only idea I have had.
onlyurei (1) [Avatar] Offline
#18
Re: RPC Fault faultString="HTTP request error"...
the status 301 works for me, thx so much
mustang (3) [Avatar] Offline
#19
Re: RPC Fault faultString="HTTP request error"...
I've got the same issue with Rails 2.0.2

See http://www.manning-sandbox.com/thread.jspa?threadID=24553

Thanks.
bullfish (1) [Avatar] Offline
#20
Re: RPC Fault faultString="HTTP request error"...
I had a problem with Flex 3, Rails 2, IE 7, and the scaffolded "create" action.

By default, Rails 2 scaffolds the "create" action with a line of code as follows:
format.xml { render smilieml => @foo, :status => :created, :location => @foo }

This worked just fine in current versions of Firefox and Safari on Mac OS 10.5, as well as those browsers on WinXP. In IE6+ on WinXP, however, I got a "stream error" that I traced to an incompatible status code returned from my HTTPService call. Apparently, what's needed is a status code of 200, and what :status => :created returns is a status code of 201.

Changing the scaffolded code to read as follows:
format.xml { render smilieml => @foo, :status => :ok, :location => @foo }
restored a status code of 200, brought peace to the kingdom, and everyone lived happily ever after....
sillydave (4) [Avatar] Offline
#21
Re: RPC Fault faultString="HTTP request error"...
I just encountered this problem. Running iteration 3, page 90.

Here is the sequence of events:
- ran from IE and saw assertion
- ran from FireFox 2 and got to the MainBox screen without assertion
- tried to run debugger in FireFox from Flex Builder 3
- FB3 complained that I need to update my plugin, so I installed later r9.0.123
- now FireFox 2 gives me the assertion too.

I suspect that the error comes as part of the security fix... I will try to set the status as people have mentioned - though I'm not really familiar with these other return codes.
sillydave (4) [Avatar] Offline
#22
Re: RPC Fault faultString="HTTP request error"...
OK, false alarm on my part. I didn't notice that FB3 was launching from my filesystem location when I run the app from there - instead of through HTTP. Both IE and FireFox are ok actually.

Btw,
- does anyone know a way I can attach the debugger in FB3 to the application once I manually start it up in the browser?
- is it possible to have FB3 run the app from a web address?

For now, I'll try to deal, but not sure how I'll move forward with debugging when I need to.

Thanks, D
sillydave (4) [Avatar] Offline
#23
Re: RPC Fault faultString="HTTP request error"...
Found my answer.

In FB3,
go to "Run" menu => "Debug" sub-menu => "Other"
Windows comes up.
change the launch path from the default location in the file system to the HTTP address.

To my surprise, that actually worked. Excellent.
sillydave (4) [Avatar] Offline
#24
Re: RPC Fault faultString="HTTP request error"...
Just got to the end of the iteration where configuring FB is covered. Seems like this should come earlier in the book... smilie