Re: [xmlrpcflash-development] Reporting success
Brought to you by:
dopelogik
|
From: Isaac L. <is...@st...> - 2002-11-26 00:59:19
|
Hey Ed,
On Tuesday, November 26, 2002, at 12:09 AM, Ed Colmar wrote:
>
> Hey Isaac and everyone else.
>
> I just grabbed the newest code off viewartwork, and tweaked it a bit to
> run on my zope.
Great!
[ Zopenote:
I pasted the python code for the external method below ]
>
> This is a super simplified test, as there is only one argument, and one
> response, but I do have a little project to work on that is really this
> simple...
>
> I'm passing one variable "name" off to the server that returns "hello
> /name/". For 7 lines of code, its not too bad... =)
>
> ------------------------- Snip --------------------------
>
> #include "xml-rpc.as"
> objXMLRPC = new XMLRPC("http://xml.siegerecords.com/",30);
>
> objtest = new XMLRPC_Object("string");
> objtest.AddMember("name");
> objtest.SetValue("duh");
>
> objXMLRPC.AddParameter(objtest);
> objXMLRPC.Call("xmlrpctest");
>
> ---------------------------------------------------------
>
> Now on to play with a little movie that uses it in this simple way...
I'm going to assume you are trying to impliment this in a useful manner
now:
OK- for the moment, as Patrick has provided the patch that strips out
all the (buggy) rsponse-hhandling methods,
http://sourceforge.net/mailarchive/
forum.php?thread_id=1275926&forum_id=12944
You'd then need in your response to grab the response method out of the
xml returned,
(which you can get like so:
------------------snippet-----------------------------
// put somewhere in the second frame of the .fla file:
trace(objXMLRPC.methodResponse);
------------------end snippet-------------------------
> After that... I'll need to get multiple return values figured out.
Right- if you call your created 'objXMLRPC.methodResponse', you get the
raw xml, and can pull the variables out by making it a native flash xml
object.
That's right where we're at, big picture stylin'.
Chad and I have been going through the xmlrpc spec for a good chunk of
today, and comparing it to the base actionscript library- so we end up
truly constructing useful objects from the return values.
Once that is sorted a bit better, we can create the return parsing
methods- (with the intention of not making a user of the lib. have to
parse xml- a time consuming dev. task...)
ANY xml parsing actionscript which you generate while working, would be
much appreciated... and I'll be sure to post any useful snippets as we
go along...
Rocket-
.ike
Isaac Levy
+ Office of Structured Systems
http://structuredsystems.net
------------------snippet-----------------------------
------------------Zope/Python External Method---------
------------------Lots of comments...-----------------
"""
a server-response to generate most every xmlrpc object possible, for
parsing
based on the server-response xml bundled with Patrick O'Lone's orignial
xmlrpc client
for flash, 0.5 Alpha (http://xmlrpcflash.sf.net)
"""
import xmlrpclib
# import is only usefull when handling:
# Boolean
# DateTime
# Binary data
ikenote="""
This method is meant to mimmic the resoponse xml which
came with Patrick's xmlrpcflash 0.5 Alpha. This method
is currently a work in progress, as I'm still not taking
time to return multiple params, plus these 3 object types:
DateTime, Boolean, and Base64 Binaries.
"""
def test_response():
## first, let's define some standard object variables:
# an int or i4
myServerIntiger=4
# a double
myServerFloat=4.9
# a string
myServerString='hello actionscript world'
# an array
myServerArray1=('one', 2, myServerFloat)
myServerArray2=(myServerIntiger, 2, 'three')
# a struct
myServerDict={'foo':'eggs', 'bar':2, 'fooBar':myServerString}
## the following values use the handy methods from xmlrpclib
# boolean values (best to use the xmlrpc boolean values)
##myTrue=xmlrpclib.True
##myFalse=xmlrpclib.False
# a DateTime value (dateTime.iso8601)
##myTimestamp=xmlrpclib.DateTime()
##myTimeWas=xmlrpclib.DateTime('19980717T14:08:55')
# example Binary Value
##myB64_obj=xmlrpclib.Binary('eW91IGNhbid0IHJlYWQgdGhpcyE=')
#now let's make the response, (not fully using all of the above
objects)
# an example of an array with all the types:
# string, int, (i4- same as int in Python), base64 (ikenote myB64_obj,
missing here, double, dateTime, boolean
##myParam1=('hello world', -12, -12, myB64_obj, -12.214, myTimestamp,
myTrue)
myParam1=('hello world', -12, -12, -12.214)
# struct with nested array as struct object
##myParam2={'lowerBound':18, 'upperBound':139, 'testArray':(12,
'Egypt', myFalse, -31)}
myParam2={'lowerBound':18, 'upperBound':139, 'testArray':(12, 'Egypt',
-31, ikenote)}
return (myParam1, myParam2) # this returns the <params>
------------------end snippet-------------------------
|