[Twisted-Python] Deserializing AMP callRemoteString without knowing the Command's signature

Eric P. Mangold eric at teratorn.org
Sat Jul 7 21:32:08 EDT 2012

On Tue, Jun 26, 2012 at 02:09:59PM -0500, Laurens Van Houtven wrote:
> Hi,
> As some of you may know I am working on a JSON-RPC <-> AMP bridge to
> consume AMP services from browsers. WIP: http://lvh.github.com/amphibian/
> I've hit a failing integration test. I know what the issue is -- I don't
> know how to resolve it.
> I attempted to write the proxy without any knowledge of the remote
> commands.

If my "proxy" you mean in the style of Python's built-in XMLRPC Proxy
class then I think that is the wrong approach for AMP - you have to have
Command signatures available ahead of time for a BINARY protocol.
Guessing just isn't any fun or even useful at all.

Static typing on the wire - yess.

> It assumes that the JSON provided satisfies the remote signature.
> If it doesn't -- that's okay, we'll get a failure back from the AMP server.
> So, I use callRemoteString and manually serialize by typechecking. Although
> that works for sending, the result I get back from callRemoteString is also
> in wire format. Because I don't know the signature, I have no idea if the
> sender meant 4, "4", u"4"...

> On IRC:
> dreid pointed out that I really shouldn't need a language-specific
> implementation of a class for this to work
> teratorn pointed out that there is a JSON schema ticket for AMP. Perhaps
> there should also be a "DiscoverSchema" command?
I've been calling that "Service Discovery" or "Route Discovery" for a while.
And yes, we should have *something* allowing AMP to complete effectively in
the "webservice" space (whatever that is).

The ticket for an AMP Schema is #5532

I would suggest extending the existing proposal with route

I'm a little bit unclear on what an AMP route is, but as I understand
it, it is basically a set of AMP Commands that are available at some
known location - useful for segregating functionality (pre-login,
post-login, user, admin, etc). Glyph, is that right?

There is some code from Divmod lying around somewhere that needs to be
looked at.

There is a ticket for AMP URLs that include route paths. #5548

This would be a great area for someone to come in and try and connect
these disparate threads together!


More information about the Twisted-Python mailing list