ws-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Henry Story <henry.st...@bblfish.net>
Subject Re: Announce: Apache XML-RPC 2.0
Date Sat, 28 May 2005 07:45:26 GMT
With the beta I was able to get the whole content of the request and  
the response with a subclass
like the following. Perhaps you can use a similar trick to get the  
http request header?

class SavingXmlRpcTransport extends DefaultXmlRpcTransport {
     private CachingInputStream cachingInputStream;

     /**
      * Create a new DefaultXmlRpcTransport with the specified URL.
      *
      * @param url the url to POST XML-RPC requests to.
      */
     public SavingXmlRpcTransport(URL url) {
         super(url);
     }

     byte request[];

     public InputStream sendXmlRpc(byte[] request) throws IOException {
         InputStream real = super.sendXmlRpc(request);
         this.request = request;
         cachingInputStream = new CachingInputStream(real);
         return cachingInputStream;
     }

     /**
      * Cache everything that goes through the given input stream
      * in a byte array.
      */
     class CachingInputStream extends InputStream {
         InputStream wraped;
         ByteArrayOutputStream cache = new ByteArrayOutputStream();

         /**
          * @param in the byte array that is wrapped in this cache.
          */
         public CachingInputStream(InputStream in) {
             wraped = in;
         }

         public int read() throws IOException {
             int i = wraped.read();  //todo: implement
             cache.write(i);
             return i;
         }

         byte[] getcache() {
             return cache.toByteArray();
         }

     }

     byte[] getRequest() {
         return request;
     }

     byte[] getResponse() {
         return cachingInputStream.getcache();
     }

}


I can then construct the rpcClient like this

            rpcClient = new XmlRpcClient(getBlogger().getService 
().toURL(), new XmlRpcTransportFactory() {

                 public XmlRpcTransport createTransport() throws  
XmlRpcClientException {
                     lastTransport = new SavingXmlRpcTransport 
(rpcClient.getURL());
                     return lastTransport;
                 }

                 public void setProperty(String propertyName, Object  
value) {
                     //todo: implement
                 }
             });

Clearly this does not give me access to the headers. But perhaps  
something along those lines
will?


On 28 May 2005, at 00:30, Bentzion Schochet wrote:
> Hi Jochen,
> Are you able to get information about the request in this version?
> I need to get cookie and header information from each request. Is that
> possible now?
>
> Thanks,
> Ben
>
> -----Original Message-----
> From: Jochen Wiedmann [mailto:jochen.wiedmann@gmail.com]
> Sent: Friday, May 27, 2005 2:12 PM
> To: xmlrpc-user@ws.apache.org
> Subject: Announce: Apache XML-RPC 2.0
>
>
>
> Hi,
>
> the Apache XML-RPC developers are proud to announce the  
> availability of
> Apache XML-RPC 2.0. Apache XML-RPC is an implementation of the popular
> XML RPC specification (see http://www.xmlrpc.com/ for details), a
> language independent protocol for remote procedure calls based on XML
> and HTTP.
>
> Compared to the predecessor, version 1.2, a lot of refactoring has
> occurred. In particular, you may now choose between various HTTP
> implementations, including a very lightweight implementation or the
> Jakarta Commons HTTP Client. However, the most important change is,  
> that
> the current version will hopefully receive active maintenance,  
> which the
> previous didn't in the last one or two years.
>
> Apache XML-RPC is available from
>
>    http://ws.apache.org/xmlrpc/
>
>
> Jochen
>


Mime
View raw message