in reply to Accessing Trac via XML::RPC

While googling, I found this discussion of the XML RPC Plugin for Trac. I'm not sure how/whether this plugin is the one you use, but it lists the following Python code as sample code:

import xmlrpclib server = xmlrpclib.ServerProxy("http://athomas:password@localhost:8080 +/trunk/login/xmlrpc") server.wiki.putAttachment('WikiStart/t.py', xmlrpclib.Binary(open('t.p +y').read()))

So, likely, you can use that Python code to get a sample of what you have to send using XML::RPC. It seems to send a different number of paramters than your scample does, though, so maybe it's the wrong end in the tree.

From my cursory look at XML::RPC, your approach of simply sending the base64-encoded data should be OK, but maybe you need to replace it by:

my $result = $xmlrpc->call('ticket.putAttachment', 2, 'Filename', 'Some Description', sub { +{base64 => encode_base64('data, data + - it is always the data')} }, );

... which is what the "Custom Types" section at the end of the documentation suggests.

Replies are listed 'Best First'.
Re^2: Accessing Trac via XML::RPC
by PetaMem (Priest) on Jun 24, 2008 at 15:29 UTC
    Corion,
    sub { +{base64 => encode_base64('data, data - it is always the data')} + },

    that actually did the trick. Thank you very much.

    Bye
     PetaMem
        All Perl:   MT, NLP, NLU