Ola amigos...

Estou iniciando no rails + flex e com base em alguns sites tentei
fazer uns testes.

Codigo Rails
class CarController < ApplicationController
  def list
    @cars = Car.find :all
    render :xml => @cars.to_xml
  end

  def create
    @cars = Car.new(params[:cars])
    @cars.save
    render :xml => @cars.to_xml
  end
end


No flex eu tenho um grid e um botao para gravar dados na tabela. O
grid estah carregando perfeitamente mas quando clico no botao aparece
uma mensagem de erro.

Codigo Flex
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute"
        creationComplete="retorno.send()">

        <mx:HTTPService id="retorno"
                    url="http://localhost:3000/car/list"; />

    <mx:HTTPService id="enviadados"
                                url="http://localhost:3000/car/create";
                                useProxy="false"
                                method="POST"
                                result="retorno.send()"
                                contentType="application/xml">
        <mx:request xmlns="">
            <ano>{tAno.text}</ano>
            <valor>{tValor.text}</valor>
            <cor>{tCor.text}</cor>
            <modelo>{tModelo.text}</modelo>
        </mx:request>
    </mx:HTTPService>

        <mx:DataGrid horizontalCenter="0" verticalCenter="-61"
dataProvider="{retorno.lastResult.cars.car}"
alternatingItemColors="[#DBEFF1, #FFFFFF]">
                <mx:columns>
                        <mx:DataGridColumn headerText="Modelo" 
dataField="modelo"/>
                        <mx:DataGridColumn headerText="Ano" dataField="ano"/>
                        <mx:DataGridColumn headerText="Valor" 
dataField="valor"/>
                        <mx:DataGridColumn headerText="Cor" dataField="cor"/>
                </mx:columns>
        </mx:DataGrid>

        <mx:TextInput horizontalCenter="-68" verticalCenter="46" id="tModelo"/
>
        <mx:TextInput horizontalCenter="-68" verticalCenter="76" id="tAno"/>
        <mx:TextInput horizontalCenter="-68" verticalCenter="106" id="tValor"/
>
        <mx:TextInput horizontalCenter="-68" verticalCenter="136" id="tCor"/>

        <mx:Label text="Modelo" horizontalCenter="-178" verticalCenter="48"/>
        <mx:Label text="Ano" horizontalCenter="-178" verticalCenter="78"/>
        <mx:Label text="Valor" horizontalCenter="-174" verticalCenter="112"/>
        <mx:Label text="Cor" horizontalCenter="-174" verticalCenter="138"/>

        <mx:Button label="Ok" width="62" horizontalCenter="71"
verticalCenter="136" click="enviadados.send()"/>
        <mx:Button label="Limpar" horizontalCenter="143" verticalCenter="136"/
>

</mx:Application>


Erro
[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/car/create";]. URL:
http://localhost:3000/car/create";]
        at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/
internal::faultHandler()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx
\rpc\AbstractInvoker.as:216]
        at mx.rpc::Responder/fault()[E:\dev\3.0.x\frameworks\projects\rpc\src
\mx\rpc\Responder.as:49]
        at mx.rpc::AsyncRequest/fault()[E:\dev\3.0.x\frameworks\projects\rpc
\src\mx\rpc\AsyncRequest.as:103]
        at DirectHTTPMessageResponder/errorHandler()[E:\dev\3.0.x\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()


Se alguem puder ajudar fico agradecido.
--~--~---------~--~----~------------~-------~--~----~
Você recebeu esta mensagem porque está inscrito na lista "flexdev"
Para enviar uma mensagem, envie um e-mail para [email protected]
Para sair da lista, envie um email em branco para [EMAIL PROTECTED]
Mais opções estão disponíveis em http://groups.google.com/group/flexdev
-~----------~----~----~----~------~----~------~--~---

Responder a