in reply to Re: Sending application-specific XML as a string paremeter to an RPC::XML method.
in thread Sending application-specific XML as a string paremeter to an RPC::XML method.

Ok, base64 encoding looks like the way to go. This works fine for small XML documents, however, I have notced that when I try to send a large base64-encoded XML document (about 1.5 MB) in this manner, it takes an extremely long time (several minutes). I am using the loopback interface for my testing, so it is not limited by network bandwidth. Is there a more direct way to transfer large ammounts of data between the client and the server? Given that RPC::XML::Server uses HTTP::Daemon and HTTP::Response for its transport, is it possible to directly use HTTP methods such as 'GET' to transfer large documents?

Thanks,
-brian

  • Comment on Re: Re: Sending application-specific XML as a string paremeter to an RPC::XML method.

Replies are listed 'Best First'.
Re: Re: Re: Sending application-specific XML as a string paremeter to an RPC::XML method.
by Fletch (Bishop) on Mar 30, 2004 at 18:37 UTC

    Doesn't look like it as such, but peeking under the hood what you could do is to create an RPC::XML::Server instance with no_http set to true, then have your own HTTP::Daemon code which passes the body of any XML-RPC calls off to the dispatch() method. Anything which needs to return an XML file would return a URL which your HTTP::Daemon handle itself (rather than passing off to the RPC::XML::Server).

    Hopefully that made some sort of sense. :) Read the docs for RPC::XML::Server, specifically the arguments for new() and the description of dispatch().

Re: Re: Re: Sending application-specific XML as a string paremeter to an RPC::XML method.
by nenbrian (Acolyte) on Mar 30, 2004 at 20:06 UTC

    Ok, the large ammount of time spent transferring base64 encoded data appears to be spent in the client, receiving (but not decoding) the encoded data. It appears to be related to the number of newlines in the data, because if I strip them, the data is transferred in a couple seconds. Is there a way to encode the data such that there are no newlines?

      Ok, this is a little bit gross, but it is possible to use the MIME::Base64::encode_base64() method to do the encoding, and you can specify that you don't want it to insert newlines. This works, but you have to be careful to decode the data on the other end (i.e. it doesn't happen automagically), because RPC::XML doesn't know that its payload is base64 encoded. It does know if you use the XML::RPC::base64->new() method, which wraps the data in <base64> tags). Not totally ideal, but I think I have my solution. :^)

      Thanks to all for your suggestions!
      -brian