You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xmlrpc-dev@ws.apache.org by Henri Gomez <he...@gmail.com> on 2005/04/15 12:43:20 UTC

Another way ?

I'm using XML-RPC on production servers and got very important
responses, from 300kb to 3mb.

XmlRpcServer provide an execute method which return a byte[] buffer, ie :

 public byte[] execute(InputStream is)

It will be very usefull when embedding XML-RPC in a servlet engine, ie
Tomcat, to use directly the servlet OutputStream which could be
possible with a method like this :

 public int execute(InputStream is, OutputStream os)


the int code (or whatever exception could told us if we detected an
exception or normal processing).

The big advantage will be to avoid memory manipulation and as such
important garbage collection.


Regards

Re: Another way ?

Posted by Jochen Wiedmann <jo...@gmail.com>.
On 4/15/05, Henri Gomez <he...@gmail.com> wrote:

> It will be very usefull when embedding XML-RPC in a servlet engine, ie
> Tomcat, to use directly the servlet OutputStream which could be
> possible with a method like this :

See the RFC for version 3, which I have posted a few days ago.


-- 
Outside of a dog, a book is man's best friend.
Inside of a dog, its too dark to read.
(Groucho Marx)

Re: Another way ?

Posted by "Daniel L. Rall" <dl...@collab.net>.
On Fri, 2005-04-15 at 13:43 +0100, John Wilson wrote:
> On 15 Apr 2005, at 13:35, Henri Gomez wrote:
> 
> > The "content-length" header are really mandatory in specs ?
> >
> 
> Yes:
> 
> " A User-Agent and Host must be specified.
> 
>   The Content-Type is text/xml.
> 
>   The Content-Length must be specified and must be correct."
> 
> See http://www.xmlrpc.com/spec

We've beaten this one to death before:

http://www.mail-archive.com/rpc-dev@xml.apache.org/msg00016.html



Re: Another way ?

Posted by John Wilson <tu...@wilson.co.uk>.
On 15 Apr 2005, at 13:35, Henri Gomez wrote:

> The "content-length" header are really mandatory in specs ?
>

Yes:

" A User-Agent and Host must be specified.

  The Content-Type is text/xml.

  The Content-Length must be specified and must be correct."

See http://www.xmlrpc.com/spec



John Wilson
The Wilson Partnership
http://www.wilson.co.uk


Re: Another way ?

Posted by Henri Gomez <he...@gmail.com>.
The "content-length" header are really mandatory in specs ?

On 4/15/05, John Wilson <tu...@wilson.co.uk> wrote:
> 
> On 15 Apr 2005, at 11:43, Henri Gomez wrote:
> 
> > XmlRpcServer provide an execute method which return a byte[] buffer,
> > ie :
> >
> >  public byte[] execute(InputStream is)
> >
> > It will be very usefull when embedding XML-RPC in a servlet engine, ie
> > Tomcat, to use directly the servlet OutputStream which could be
> > possible with a method like this :
> >
> >  public int execute(InputStream is, OutputStream os)
> >
> 
> XML-RPC is not well suited to dealing with very large payloads. The
> specification requires that the content-length header is used which
> means that the entire request or response has to be assembled in memory
> before it is sent (i.e. you can't use chunked encoding). In addition
> the Apache XML-RPC implementation uses the Apache Commons Base64 codec
> to encode and decode byte[] values. This has no way of dealing with
> byte streams so implementing your suggestion in a way which saves
> memory would be a very extensive job. As a rule of thumb I have found
> that you need free contiguous heap memory of four times the size of the
> array when you are receiving it and three times the size of the array
> when sending it.
> 
> If you are transferring large amounts of binary data you might consider
> sending a URL which points to the data and then doing a GET on the URL.
> 
> 
> John Wilson
> The Wilson Partnership
> http://www.wilson.co.uk
> 
>

Re: Another way ?

Posted by John Wilson <tu...@wilson.co.uk>.
On 15 Apr 2005, at 11:43, Henri Gomez wrote:

> XmlRpcServer provide an execute method which return a byte[] buffer, 
> ie :
>
>  public byte[] execute(InputStream is)
>
> It will be very usefull when embedding XML-RPC in a servlet engine, ie
> Tomcat, to use directly the servlet OutputStream which could be
> possible with a method like this :
>
>  public int execute(InputStream is, OutputStream os)
>

XML-RPC is not well suited to dealing with very large payloads. The 
specification requires that the content-length header is used which 
means that the entire request or response has to be assembled in memory 
before it is sent (i.e. you can't use chunked encoding). In addition 
the Apache XML-RPC implementation uses the Apache Commons Base64 codec 
to encode and decode byte[] values. This has no way of dealing with 
byte streams so implementing your suggestion in a way which saves 
memory would be a very extensive job. As a rule of thumb I have found 
that you need free contiguous heap memory of four times the size of the 
array when you are receiving it and three times the size of the array 
when sending it.

If you are transferring large amounts of binary data you might consider 
sending a URL which points to the data and then doing a GET on the URL.


John Wilson
The Wilson Partnership
http://www.wilson.co.uk