[Zope] Flash XMLRPC clients for Zope ....
Steve Spicklemire
steve@spvi.com
Mon, 6 Aug 2001 03:43:27 -0500
Hi Nigel,
I got so frustrated with Flash Player I just cooked up my own way.
The version I was using had no way to set content type! I ended up with
a couple of external methods and a Python Script to use them. There
is/was also a problem with the Windows version of FlashPlayer. The
sendAndLoad command is supposed to do a POST, but it sends a "GET"
command, and then "POST"s anyway. ;-( So I commented out the meth != GET
below and unconditionally seek/read stdin. I posted a detailed bug
report to MM, but got no response.
Anyway.. thanks for the update. I wonder if they'll ever get it right?
;-(
-steve
On Monday, August 6, 2001, at 12:18 AM, Nigel Head wrote:
> I saw an enquiry a while back about Flash XML-RPC clients. After some
> spelunking I can add my 2 eurocents to the situation ... unfortunately
> not
> good news.
>
> The Flash player (version 42, AFAIK the newest) now claims to allow the
> setting of the Content-type, necessary for getting Zope to agree that
> this is
> xmlrpc, but still appears to have a bug where it appends a few garbage
> characters after the desired value. Zope checks for exact content type
> of
> text/xml and therefore fails to recognise the request. I haven't found
> a way
> to persuade the flash player not to do this although one may exist.
>
> I have patched my Zoep to check only the first 8 characters, this then
> works
> OK, but is ugly, and incorrect!
>
> I'll report the assumed bug to M'media and see what they have to say!
>
> regards,
>
> Nigel.
>
External Methods:
rawInput:
def getRawInput(self, REQUEST):
meth = REQUEST.environ.get('REQUEST_METHOD','GET')
if 1: # meth != 'GET':
#
# Flash has a broken .sendAndLoad() method on Windows.. so we
need to
# force a "POST" response rather than handle "GET"
#
REQUEST.stdin.seek(0)
result = REQUEST.stdin.read()
else:
result = REQUEST.environ.get('QUERY_STRING','')
return result
handleXML:
def getRawInput(self, REQUEST):
meth = REQUEST.environ.get('REQUEST_METHOD','GET')
if meth != 'GETfoo':
#
# Flash has a broken .sendAndLoad() method on Windows.. so we
need to
# force a "POST" response rather than handle "GET"
#
REQUEST.stdin.seek(0)
result = REQUEST.stdin.read()
else:
result = REQUEST.environ.get('QUERY_STRING','')
return result
Finally.. here is the PythonScript to use getRawInput and handleXML:
import string
REQUEST=context.REQUEST
rawInput = context.getRawInput(REQUEST)
if len(rawInput):
try:
xmlDict = context.handleXML(rawInput)
except:
xmlDict = {}
else:
xmlDict = {}
-steve