3 Replies Latest reply on Feb 23, 2010 11:33 AM by charlesrthompson

    Flex 3 RemoteObject Call Returns BadVersion error


      After two days of frustration I have stripped my server down to only a CFStandalone server and started over with Flex 3 attempting to fill a grid from a RemoteObject CFC call. Two days... all I want to do is see this work once, understand how it all glues together, so I can move on with life.


      ColdFusion 8, Flex 3, Flash Player 10, Win XP Pro


      I am trying to closely follow the tutorial at




      ... except the Jrun4 step does not apply so I tried to use what I've seen are the 'default' services xml settings for most remote call projects. Essentially I set it to this (at first followed by various combinations based on the CFC files)


      <endpoint uri="http://localhost:8500" class="flex.messaging.endpoints.AMFEndpoint"/>


      Essential Files...



      The MXML File


      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
              import mx.controls.Alert;
              import mx.rpc.events.FaultEvent;
              import mx.rpc.Fault;
              import mx.rpc.events.ResultEvent;


              private function onFault( e : FaultEvent ) :void
              trace( e.fault.message );

           <mx:RemoteObject id="conn" destination="ColdFusion" source="com.conjure.cfc.SCALES2"
                  result="orderGrid.dataProvider = event.result;" showBusyCursor="true"
              <mx:DataGrid id="orderGrid" top="40" left="10" right="10" bottom="10" creationComplete="conn.fill();">
                     <mx:DataGridColumn headerText="ID" width="50" dataField="iScaleIndex" />
                     <mx:DataGridColumn headerText="Scale" dataField="sScaleName" />
             <mx:Form paddingLeft="10" paddingTop="10" defaultButton="{btnSearch}" initialize="txtKeywords.setSelection(0, txtKeywords.text.length); txtKeywords.setFocus();">
                 <mx:FormItem label="Keywords:" direction="horizontal">
                     <mx:TextInput id="txtKeywords"/>
                     <mx:Button label="Search" click="conn.getData(txtKeywords.text); txtKeywords.setSelection(0, txtKeywords.text.length);" id="btnSearch"/>




      No matter what I do in the services XML, endpoint or source paths I get this (URL changing to suit whatever I've config'ed obviously):



      faultString:'Send failed'


      error NetConnection.Call.BadVersion: :

      url: 'http://localhost:8500/CFSRVREMOBJ-debug''


      I've searched most of the day with zero real world explanations on what I've done wrong.


      Any clues?

        • 1. Re: Flex 3 RemoteObject Call Returns BadVersion error
          Peter Farland Level 3

          When you specify an endpoint attribute on <mx:RemoteObject> you're

          overriding the endpoints configured in services-config.xml. That said, the

          endpoint URL you're using on the RemoteObject doesn't look quite right.


          The bad version error means that some data came back, but it wasn't AMF

          formatted (the content was likely an HTML error page).


          When using AMF over HTTP with ColdFusion, you're really just sending an AMF

          formatted binary POST to a servlet. This servlet will have a servlet mapping

          in the ColdFusion web app's /WEB-INF/web.xml file. It is probably mapped to

          /flex2gateway/* (meaning all requests to /flex2gateway will be redirected to

          the message broker servlet).


          Assuming that you haven't deployed CF to a custom context root, can you try

          something like this?


          <mx:RemoteObject id="conn" destination="ColdFusion"



              result="orderGrid.dataProvider = event.result;"

              showBusyCursor="true" fault="onFault(event)">


          • 2. Re: Flex 3 RemoteObject Call Returns BadVersion error
            charlesrthompson Level 1



            Thank you for explaining the purpose and location of that flex2gateway path. Honestly since I'm new to Flex and started with 3 I thought that was some kind of older/depricated requirement and never paid it alot of attention in favor of the services XML tweaks (which I've set back to default as my understanding is that Flex 3 fills in all the {data} on compile. I'm still in the weeds, but am getting there. After changing the endpoint (and checking that the flex2gateway was indeed setup in web.xml.. it was) I now get:



            faultString:'Send failed'


            error NetConnection.Call.Failed: HTTP: Failed: url: 'http://localhost:8500/flex2gateway''


            What are common causes of the Send failed message?



            • 3. Re: Flex 3 RemoteObject Call Returns BadVersion error
              charlesrthompson Level 1



              I'm still struggling with this but something you said kind of got me thinking.


              Before I was getting badversion, now I get a send error. You noted that with BadVersion I got 'something' back.. but it wasn't AMF format.


              Is it possible that with BadVersion I have the path to the server right and am getting 'something' but the 'Send' error is possibly meaning I'm not even close in hitting the CFC target? In other words.. I'm hitting the CFC in the 'BadVersion' scenario and while the CFC works from an CFM page call, something is causing the AMF data to be corrupt? (Page debugging, whitespace? All the usual CF file/format eating gremlins)


              I just can't seem to find a way to get a better debugging trace between Flex and ColdFusion so I can understand exactly what is wrong. If I convert a remoteobject over to a WSDL call I can touch it and get limited success on basic stuff like returning text.. a DB record count. Advanced reads/queries fail with not-so-revealing fault messages.


              Between the various ways to pull this off the common problem appears to be a robust error trace. Any pointers/URLs that might point me towards better debugging resources?