View Full Version : Data Conversion Error
dicklacara
03-16-2004, 06:30 AM
I am a Newbie to Laszlo and am working my way thru the tutorials.
In the Data-Driven Applications tutorial i am almost successful.
I have been able to interface the tutorial client example to (display update and modify) a real database (MySQL) via a server-side program written in ColdFusion (CFMX).
The CFMX program retrieves all the contacts and sends an XML packet to the Laszlo client where they are displayed. This part works fine,
When I try to Add, Update, or delete a contact, the client program fails with a dataconversion error -- apparently when building the name/value pairs to be appended to the URL.
I am not too clear on this as the Laszlo debugger truncates the error message containing the URL.
for example, if I try an add a record with:
First Name: a
Last Name : b
Phone: c
email: d
the debugger shows the truncated error message:
data conversion error for http://localhost/cfusion/Laszlo/contactMgr.cfm?email=d&phone=c&lastname=
I am pretty sure the failure occurs in the client before ever passing the request to the host.
I have searched the Laszlo site and can find no reference to the data conversion error messsage.
I would like to get this resolved -- Laszlo lookes like a pretty good way to create the client side of RIAs.
TIA
Dick
Can you post the code you are using to construct the request? Also maybe something from your server lps.log or apache log to show what is being requested? You can set debug logging level for the lps.log by modifying the lps.xml file in WEB-INF/config and change log level from "info" to "debug"
dicklacara
03-16-2004, 07:52 AM
Thanks for the reply
The code is the last part of the database tutorial.
I don't think that any request gets passed to the host -- think it fails client-side.
I will check the logs, tho.
In the mean time, here's the code:
The only changes from the tutorial example are the 2 dataset tags.
-- the first works -- the getContacts.cfm program gets all the contact records from the db and returns an XML packet.
-- The second program only dumps the URL & Form variables it receives -- iI wasn't sure how Laszlo passed the request to the server; But, I don't think any request gets to the server.
TIA
Dick
The Code
<canvas bgcolor="#D4D0C8">
<dataset name="dset" src="http://localhost/cfusion/Laszlo/getContacts.cfm" autorequest="true" type="http"/>
<!-- 1 -->
<dataset name="dsSendData" request="false" src="http://localhost/cfusion/Laszlo/contactMgr.cfm" type="http"/>
<class name="contactview" extends="view" visible="false" x="20" height="120">
<!-- 2 -->
<text name="pk" visible="false" datapath="@email"/>
<text y="10">First Name:</text>
<edittext name="firstName" datapath="@firstName" x="80" y="10"/>
<text y="35">Last Name:</text>
<edittext name="lastname" datapath="@lastName" x="80" y="35"/>
<text y="60">Phone:</text>
<edittext name="phone" datapath="@phone" x="80" y="60"/>
<text y="85">Email:</text>
<edittext name="email" datapath="@email" x="80" y="85"/>
<method name="sendData" args="action">
var d=canvas.datasets.dsSendData; // 3
var p=new LzParam(); // 3a
p.addValue( "action", action, true);
p.addValue( "pk", pk.getText(), true);
p.addValue( "firstName", firstName.getText(), true);
p.addValue( "lastName", lastName.getText(), true);
p.addValue( "phone", phone.getText(), true);
p.addValue( "email", email.getText(), true); // 3b
d.setQueryString( p ); // 3c
d.doRequest(); // 3d
</method>
<!-- 4 -->
</class>
<simplelayout axis="y"/>
<view>
<simplelayout axis="y"/>
<text onclick="parent.newContact.setVisible(!parent.newContact.vi sible);">New Entry...</text>
<contactview name="newContact" datapath="new:/contact">
<button width="80" x="200" y="10">Add
<method event="onclick">
parent.sendData("insert"); // 5
parent.datapath.updateData();
var dp=canvas.datasets.dset.getPointer();
dp.selectChild();
dp.addNodeFromPointer( parent.datapath );
parent.setVisible(false);
parent.setDatapath("new:/contact");
</method>
</button>
</contactview>
</view>
<view datapath="dset:/phonebook/contact">
<simplelayout axis="y"/>
<view name="list" onclick="parent.updateContact.setVisible(!parent.updateCont act.visible);">
<simplelayout axis="x"/>
<text datapath="@firstName"/>
<text datapath="@lastName"/>
<text datapath="@phone"/>
<text datapath="@email"/>
</view>
<contactview name="updateContact">
<button width="80" x="200" y="10">Update
<method event="onclick">
parent.sendData("update"); // 6
parent.parent.datapath.updateData();
</method>
</button>
<button width="80" x="200" y="40">Delete
<method event="onclick">
parent.sendData("delete"); // 7
parent.parent.datapath.deleteNode();
</method>
</button>
</contactview>
</view>
</canvas>
dicklacara
03-16-2004, 08:28 AM
As I suspected, the Apache logs show no requests for the second URL -- the one initiated by an add or update.
However, the LPS log gave enough info to resolve the problems -- both client-side and server-side errors.
Dick
A couple of tips:
in <canvas> you can make the text width wider when debugging
<canvas width="1024" maxtextwidth="4096"> will add lots of width to the debugger text area.
I made up a dummy XML data file and a dummy target for app to post new data to, and ran it, and your app ran without any error. I added a new contact and clicked the button, and it made the request to the server. I changed the URLs from absolute to relative though:
<dataset name="dset" src="contact.xml" autorequest="true" type="http"/>
<!-- 1 -->
<dataset name="dsSendData" request="false" src="data.php" type="http"/>
I made a little dummy target page data.php, just to make a target the app could request a valid URL to request.
You are running your cold fusion server on the same machine you are running the LPS server on, right? Because 'localhost' will be resolved at the server.
In the example you sent me, you get the initial contact data from the server correctly right? It's only when you add a new contact that the request seems to fail?
Here is what I see in my server log when I hit "add" button. Turn on debugging on your LPS server and
tell me what you are seeing, also with the wider debug text, tell me what the error you get looks like.
In your WEB-INF/lps/config dir. change the log level to "debug"
<logger name="com.laszlosystems" additivity="false">
<priority value="debug" />
<appender-ref ref="lps" />
</logger>
That will print a lot of trace info to the lps.log file on your web server.
18 Mar 2004 09:32:24 (127.0.0.1 100) DEBUG data.DataSource - 'url' is http://localhost:8080/lps/test/data.php?email=&phone=&lastName=bar&firstName=foo&pk=&action=insert
18 Mar 2004 09:32:24 (127.0.0.1 100) DEBUG utils.LZHttpUtils - modifyWEBAPP
18 Mar 2004 09:32:24 (127.0.0.1 100) DEBUG server.Configuration - No option for proxy-security-urls
18 Mar 2004 09:32:24 (127.0.0.1 100) DEBUG data.DataSource - 'url' is http://localhost:8080/lps/test/data.php?email=&phone=&lastName=bar&firstName=foo&pk=&action=insert
18 Mar 2004 09:32:24 (127.0.0.1 100) DEBUG utils.LZHttpUtils - modifyWEBAPP
18 Mar 2004 09:32:24 (127.0.0.1 100) DEBUG responders.ResponderCache - urlstr http://localhost:8080/lps/test/data.php?email=&phone=&lastName=bar&firstName=foo&pk=&action=insert
18 Mar 2004 09:32:24 (127.0.0.1 100) DEBUG responders.ResponderCache - ds is http
18 Mar 2004 09:32:24 (127.0.0.1 100) INFO responders.ResponderCache - proxying http://localhost:8080/lps/test/data.php?email=&phone=&lastName=bar&firstName=foo&pk=&action=insert, not cacheable on server or client
18 Mar 2004 09:32:24 (127.0.0.1 100) DEBUG data.DataSource - 'url' is http://localhost:8080/lps/test/data.php?email=&phone=&lastName=bar&firstName=foo&pk=&action=insert
18 Mar 2004 09:32:24 (127.0.0.1 100) DEBUG utils.LZHttpUtils - modifyWEBAPP
18 Mar 2004 09:32:24 (127.0.0.1 100) INFO internal.DataSourceInternal - requesting URL: 'http://localhost:8080/lps/test/data.php?email=&phone=&lastName=bar&firstName=foo&pk=&action=insert'
18 Mar 2004 09:32:24 (127.0.0.1 100) DEBUG data.DataSource - 'url' is http://localhost:8080/lps/test/data.php?email=&phone=&lastName=bar&firstName=foo&pk=&action=insert
18 Mar 2004 09:32:24 (127.0.0.1 100) DEBUG utils.LZHttpUtils - modifyWEBAPP
18 Mar 2004 09:32:24 (127.0.0.1 100) DEBUG utils.LZHttpUtils - proxyRequestHeaders
18 Mar 2004 09:32:24 (127.0.0.1 100) DEBUG utils.LZHttpUtils - accept=*/*
18 Mar 2004 09:32:24 (127.0.0.1 100) DEBUG utils.LZHttpUtils - x-flash-version=7,0,14,0
18 Mar 2004 09:32:24 (127.0.0.1 100) DEBUG utils.LZHttpUtils - user-agent=Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
18 Mar 2004 09:32:24 (127.0.0.1 100) DEBUG utils.LZHttpUtils - cookie=Bugzilla_login=49; Bugzilla_logincookie=701; BUGLIST=1287%3A1805%3A2183%3A2346%3A2271%3A2275%3A 2294%3A2317%3A2620%3A2749%3A2960%3A3078%3A3158%3A3 337%3A3419%3A3470%3A3471%3A3514%3A3699%3A3680%3A36 98%3A1965%3A3649%3A3667%3A3703%3A3485%3A686%3A1142 %3A1316%3A1382%3A1520%3A1948%3A2023%3A3034%3A2265% 3A2354%3A2361%3A2399%3A2408%3A2667%3A2692%3A2746%3 A2989%3A2917%3A3102%3A3120%3A3141%3A3149%3A3273%3A 3242%3A3453%3A3228%3A3250%3A3304%3A3309%3A3351%3A3 393%3A3446%3A3499%3A3515%3A3527%3A382%3A399%3A448% 3A542%3A671%3A874%3A1128%3A1029%3A1059%3A1105%3A11 43%3A1182%3A1198%3A1202%3A1235%3A1244%3A1286%3A137 5%3A1388%3A1391%3A1434%3A1564%3A1632%3A1659%3A1667 %3A1697%3A1761%3A1762%3A1789%3A1794%3A1795%3A1848% 3A1886%3A1941%3A1947%3A2022%3A2080%3A2105%3A2146%3 A2235%3A2416%3A2413%3A2449%3A2465%3A2493%3A2517%3A 2532%3A2658%3A2736%3A2850%3A2930%3A3380%3A3457%3A3 601%3A877%3A428%3A1459%3A2098%3A2104%3A3567%3A3666 ; LASTORDER=bugs.priority%2Cbugs.bug_id; VERSION-LPS=trunk; RT_USERNAME=guest; VERSION-Feature Requests=unspecified
18 Mar 2004 09:32:24 (127.0.0.1 100) DEBUG internal.HTTPDataSource - Parsing url
18 Mar 2004 09:32:24 (127.0.0.1 100) DEBUG internal.HTTPDataSource - encoded path: /lps/test/data.php
18 Mar 2004 09:32:24 (127.0.0.1 100) DEBUG internal.HTTPDataSource - encoded query: email=&phone=&lastName=bar&firstName=foo&pk=&action=insert
18 Mar 2004 09:32:24 (127.0.0.1 100) DEBUG internal.HTTPDataSource - setting up http client
18 Mar 2004 09:32:24 (127.0.0.1 100) DEBUG internal.HTTPDataSource - timeout set to 10000
18 Mar 2004 09:32:24 (127.0.0.1 100) DEBUG internal.HTTPDataSource - starting remote request
18 Mar 2004 09:32:24 (127.0.0.1 100) DEBUG internal.HTTPDataSource - remote response status: OK
18 Mar 2004 09:32:24 (127.0.0.1 100) DEBUG internal.DataSourceInternal - got data
18 Mar 2004 09:32:24 (127.0.0.1 100) DEBUG utils.LZHttpUtils - proxyResponseHeaders
18 Mar 2004 09:32:24 (127.0.0.1 100) DEBUG utils.LZHttpUtils - ETag=W/"26-1079620326655"
18 Mar 2004 09:32:24 (127.0.0.1 100) DEBUG utils.LZHttpUtils - Date=Thu, 18 Mar 2004 14:32:24 GMT
18 Mar 2004 09:32:24 (127.0.0.1 100) DEBUG utils.LZHttpUtils - Server=Apache Coyote/1.0
18 Mar 2004 09:32:24 (127.0.0.1 100) DEBUG internal.HTTPDataSource - content type:
18 Mar 2004 09:32:24 (127.0.0.1 100) DEBUG internal.HTTPDataSource - content type:
18 Mar 2004 09:32:24 (127.0.0.1 100) WARN internal.XMLConverter - back-end mime-type is , treating as text/xml
18 Mar 2004 09:32:24 (127.0.0.1 100) DEBUG internal.HTTPDataSource - content type:
18 Mar 2004 09:32:24 (127.0.0.1 100) DEBUG internal.XMLConverter - Output:63
18 Mar 2004 09:32:24 (127.0.0.1 100) DEBUG internal.XMLConverter - Output:
<resultset><body>
<foo>
<bar/>
</foo>
</body></resultset>
18 Mar 2004 09:32:24 (127.0.0.1 100) DEBUG internal.DataSourceInternal - converted to 350 bytes of SWF
18 Mar 2004 09:32:24 (127.0.0.1 100) DEBUG internal.DataSourceInternal - setting content length: 350
18 Mar 2004 09:32:24 (127.0.0.1 100) INFO internal.DataSourceInternal - 350 bytes sent
18 Mar 2004 09:32:24 (127.0.0.1 100) DEBUG servlets.LZServlet - Request 100 finished
band1
11-02-2005, 12:13 AM
I think that this is what happens:
If there is a post/get to a url that
does not return an xml then this
error appears:
«string(2125)#0| data conversion error for http://
If the url returns some sort of a confirmation
like <msg>ok</msg> then all works well.
Originally posted by band1
I think that this is what happens:
If there is a post/get to a url that
does not return an xml then this
error appears:
«string(2125)#0| data conversion error for http://
If the url returns some sort of a confirmation
like <msg>ok</msg> then all works well.
I'm in a very similar situation, in my case I get:
ERROR: data conversion error for http://localhost:8080/exist/xquery/crud-cartells.xq?llocfd=Barcelona&idfd=7: Error on line 31 of document http://www.w3.org/TR/html4/loose.dtd: The declaration for the entity "HTML.Version" must end with '>'.
And that in spite of my application returning: <msg>ok</msg>
Any hints?
TIA, Juan
rosenjiang
11-15-2006, 07:05 AM
I think that this is what happens:
If there is a post/get to a url that
does not return an xml then this
error appears:
«string(2125)#0| data conversion error for http://
If the url returns some sort of a confirmation
like <msg>ok</msg> then all works well.
very good! great! thx band1.:D
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.