XML RPC Woes
Brian Quinlan
brian at sweetapp.com
Mon Feb 25 13:11:04 EST 2002
Mark J Nenadov wrote:
> I am attempting to send an mcrypt'ed string to
> an xmlrpc function. The server is returning the
> same "Internal Error" that I got before. I
> assume that it is because it doesn't recognize
> the type, though the type() function identifies
> the result of the mcrypt as a string.
I don't know what the output of mcrypt is but I would assume that it can
include characters that aren't valid XML characters. That is likely
causing your problem.
> I assume that I need to do some sort of encoding
> since the mcrypt'ed string is probably not a normal
> string. From the documentation I have read, it
> seemed that I needed to call the xmlrpclib.binary()
> method, which gives me an "incorrect padding"
> error. Is xmlrpclib.binary() required to get an
> mcrypt'ed string to be accepted by the XMLRPC
> server?
Close. What you actually want to do return/pass a xmlrpclib.Binary
object. You would use it this way:
# Client usage
s = xmlrpclib.Server(...)
s.method(xmlrpclib.Binary(mcrypted_string))
# Server usage
def do_something():
return xmlrpclib.Binary(mcrypted_string)
s = SimpleXMLRPCServer(...)
s.register_function(do_something)
> I realize that you don't maintain xmlrpclib, but
> I thought you might have some insight that I
> couldn't find in the documentation.
No problem. Please CC these questions to the Python list though so the
question and answer will be archived.
Cheers,
Brian
More information about the Python-list
mailing list