Re: Empty strings in XML-RPC struct replies
Re: Empty strings in XML-RPC struct replies
- Subject: Re: Empty strings in XML-RPC struct replies
- From: Axel Luttgens <email@hidden>
- Date: Sun, 18 Oct 2009 16:13:43 +0100
Le 17 oct. 2009 à 22:45, Jeff Jungblut a écrit :
[...]
The property name does not matter; 'empty' is not special. I changed
the
property name to 'blahblah' and got the same result.
OK, thanks for having done the test.
One may thus exclude some internal terminology clashes and really
suspect a bad interpretation of empty strings appearing in structs;
when debugging at the AppleEvents level, one indeed has:
event data:
{ 1 } 'aevt': - 1 items {
key '----' -
{ 1 } 'reco': - 1 items {
key 'usrf' -
{ 1 } 'list': - 10 elements {
{ 1 } 'ut16': 18 bytes {
000: fffe 6200 6c00 6100 6800 6200 6c00
6100 ..b.l.a.h.b.l.a.
001:
6800 h.
}
{ -1 } 'null': null descriptor
{ 1 } 'ut16': 8 bytes {
000: fffe 6100 6700
6500 ..a.g.e.
}
{ 1 } 'long': 4 bytes {
43 (0x2b)
}
{ 1 } 'ut16': 14 bytes {
000: fffe 7700 6500 6900 6700 6800
7400 ..w.e.i.g.h.t.
}
{ 1 } 'ut16': 8 bytes {
000: fffe 3100 3600
3500 ..1.6.5.
}
{ 1 } 'ut16': 14 bytes {
000: fffe 6800 6500 6900 6700 6800
7400 ..h.e.i.g.h.t.
}
{ 1 } 'ut16': 18 bytes {
000: fffe 7300 6900 7800 2000 6600 6500
6500 ..s.i.x. .f.e.e.
001:
7400 t.
}
{ 1 } 'ut16': 12 bytes {
000: fffe 6500 6d00 7000 7400
7900 ..e.m.p.t.y.
}
{ -1 } 'null': null descriptor
}
}
}
And those 'null' values subsequently are somehow re-interpreted as
"current application".
Given the lack of references to that problematic behavior, I'm
wondering whether that behavior is a new one, or if it has been there
for a while.
I'm here with 10.6.1; could someone try
tell application "http://cleverdev.net/xmlrpctest.php" to set theData
to call xmlrpc {method name:"rpcTest.getStruct", parameters:{}}
on other versions of Mac OS X?
(of course, this assumes that Jeff leaves the code active on the server)
[...]
Thanks, that does work. But my example above was just a simple test
case to
verify the bug.
For my real application, I'm doing many different XMLRCP calls to
get rows
from different tables in a MySQL database, where string fields in the
returned rows may or not be empty, and checking the value of every
field
(property) of every returned row and setting it to an empty string
if it's a
bogus app reference will slow down the app (and would add a
considerable
amount of code bloat). Not practical.
Well, I'm not sure whether the overhead would really be noticeable,
especially in comparison to the time spent with the xmlrpc calls.
As far as the amount of additional code is concerned: assuming that
the tests and the eventual updates are rather quick, perhaps just
augmenting the retrieval of the xmlrpc data with the code strictly
needed to take the bug into account may help to keep the overall
logics rather clean.
Something like this:
property xmlrpc_bug : true
tell application "http://cleverdev.net/xmlrpctest.php" to set theData
to call xmlrpc {method name:"rpcTest.getStruct", parameters:{}}
if xmlrpc_bug then
tell theData
if class of it's blahblah is application then set it's blahblah to ""
if class of it's empty is application then set it's empty to ""
end tell
end if
I’ve started worked around the problem by using the method calls which
return lists of records to just copy the data to a table view. The
table
view correctly shows an empty cell instead of an app reference for any
properties which contain empty strings. Then when I need to get the
correct
values from a given row in the table, I do a second xmlrpc call which
fetches a single row as a list of values instead of a record, and then
access the values by index instead of property name.
The problem being thus that, in order to take a client-side bug into
account, you probably are making both the server's and the client's
code less legible and maintainable.
This could be a reasonable price to pay only if the overhead of the
above suggestion appears to be unsustainable and if the bug is with us
since sooo long that it would be unrealistic to hope some quick fix
from Apple.
When running inside an ASS app, the console shows this error for
every field
in every row that contains an empty string:
2009-10-17 14:09:21.250 WebZine[98024:903] A key or value could not be
handled while converting an Apple event record to an NSDictionary.
Researching that error directs me to this page, but I don’t speak
Japanese
Nor do I...
so it’s not of much help:
http://ppmweb.lolipop.jp/kaku-10-release/
so that I just couldn't understand the slightest part of it. :-(
Axel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden