0 Replies Latest reply on Apr 2, 2008 7:36 AM by Gene Godsey

    Runtime error trying to connect to ColdFusion files.

    Gene Godsey Level 1
      I am trying to figure out what this issue is here. I have the following code to pull and manipulate data from an access database via CF8.
      ----------------
      <cfprocessingdirective pageencoding = "utf-8" suppressWhiteSpace = "Yes">
      <cfif isDefined("username") and isDefined("emailaddress") and username NEQ "">
      <cfquery name="addempinfo" datasource="flex">
      INSERT INTO users (username, emailaddress)
      VALUES (<cfqueryparam value="#username#" cfsqltype="CF_SQL_VARCHAR" maxlength="255">, <cfqueryparam value="#emailaddress#" cfsqltype="CF_SQL_VARCHAR" maxlength="255"> )
      </cfquery>
      </cfif>

      <cfquery name="alluserinfo" datasource="flex">
      SELECT userid, username, emailaddress
      FROM users
      </cfquery>
      <!--- <div align="center">
      <cfdump var="#alluserinfo#">
      </div> --->


      <cfxml variable="userXML">

      <users>
      <cfloop query="alluserinfo">
      <cfoutput>
      <user>
      <userid>#toString(userid)#</userid>
      <username>#username#</username>
      <emailaddress>#emailaddress#</emailaddress>
      </user>
      </cfoutput>
      </cfloop>
      </users>
      </cfxml>
      <cfdump var=#userXML#>
      <!--- <cfoutput>#userXML#</cfoutput> --->
      </cfprocessingdirective>
      ---------------

      Here is the MXML Code.
      ---------------------------------
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" xmlns="*"
      layout="absolute" creationComplete="userRequest.send()">

      <mx:HTTPService id="userRequest" url=" http://localhost/test/test%20Apps/flex.cfm" useProxy="false" method="POST">
      <mx:request xmlns="">
      <username>{username.text}</username><emailaddress>{emailaddress.text}</emailaddress>
      </mx:request>
      </mx:HTTPService>

      <mx:Form x="22" y="10" width="493">
      <mx:HBox>
      <mx:Label text="Username"/>
      <mx:TextInput id="username"/>
      </mx:HBox>
      <mx:HBox>
      <mx:Label text="Email Address"/>
      <mx:TextInput id="emailaddress"/>
      </mx:HBox>
      <mx:Button label="Submit" click="userRequest.send()"/>
      </mx:Form>

      <mx:DataGrid id="dgUserRequest" x="22" y="128" dataProvider="{userRequest.lastResult.users.user}">
      <mx:columns>
      <mx:DataGridColumn headerText="User ID" dataField="userid"/>
      <mx:DataGridColumn headerText="User Name" dataField="username"/>
      </mx:columns>
      </mx:DataGrid>

      <mx:TextInput x="22" y="292" id="selectedemailaddress" text="{dgUserRequest.selectedItem.emailaddress}"/>
      </mx:Application>
      ---------------------------------



      I get this runtime error.
      ---------------------------
      [RPC Fault faultString="Error #1090: XML parser failure: element is malformed." faultCode="Client.CouldNotDecode" faultDetail="null"]
      at mx.rpc.http::HTTPService/ http://www.adobe.com/2006/flex/mx/internal::processResult()[E:\dev\3.0.x\frameworks\projec ts\rpc\src\mx\rpc\http\HTTPService.as:842
      at mx.rpc::AbstractInvoker/ http://www.adobe.com/2006/flex/mx/internal::resultHandler()[E:\dev\3.0.x\frameworks\projec ts\rpc\src\mx\rpc\AbstractInvoker.as:186
      at mx.rpc::Responder/result()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\Responder.as:4 1]
      at mx.rpc::AsyncRequest/acknowledge()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\AsyncR equest.as:74]
      at DirectHTTPMessageResponder/completeHandler()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\ messaging\channels\DirectHTTPChannel.as:381]
      at flash.events::EventDispatcher/dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at flash.net::URLLoader/onComplete()
      ---------------------------

      The XML Data is formed properly.

      What now?

      Thanks,
      Gene Text