[OpenDHT-Users] put_removable not working with Ruby

Sean Rhea srhea@MIT.EDU
Mon, 1 May 2006 09:04:06 -0400


This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--Apple-Mail-43-677722308
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed

On May 1, 2006, at 12:35 AM, Alyed Tzompa wrote:
> I'm having problems making a "put_removable" (actually not even a  
> "put" works for me) to openDHT. I'm using Ruby 1.8.4-16 and get the  
> following message:
>
> java.lang.NoSuchMethodException: bamboo.dht.Gateway 
> $XmlRpcPutRemovableHandler.put_removable(java.lang.String,  
> java.lang.String, java.lang.String, java.lang.String, int,  
> java.lang.String, java.lang.String, java.net.InetSocketAddress,  
> bamboo.util.Curry$Thunk1)

The function that should be being called is:

public class XmlRpcPutRemovableHandler {
         public void put_removable (byte [] key_bytes, byte [] value,
                 String hash_alg, byte [] secret_hash, int ttl_sec,
                 String application, String user_agent,
                 InetSocketAddress client, Thunk1<Object> result_cb) {
             ...
         }
};

Note the byte[]'s where the exception shows strings.  My guess is  
that your calls to Base64.encode are not enough to get Ruby's XML RPC  
client to encode data with <Base64> tags; i.e., it's sending the base  
64 strings, but enclosed in <String> tags instead.

I don't know Ruby, but this guess should be easy to verify with a  
packet trace.

Sean

> --------------------------------------
> #code extract
>
> dhtServer = XMLRPC::Client.new("169.229.50.15","/",5851)
> dhtKey64 = Base64.encode64(dhtKey)
> dhtValue64 = Base64.encode64(dhtValue)
>
> begin
>
> dhtStatus = dhtServer.call 
> ("put_removable",dhtKey64,dhtValue64,"SHA",secret.toSha, 
> 60.to_i,"my_app")
>   rescue XMLRPC::FaultException => error
>   puts error.faultCode
>   puts error.faultString
>
> end
> ----------------------------------
-- 
           The Law of Unintended Consequences:  for every action,
            there is an excellent chance of producing an opposite
                   and totally disproportionate reaction.
                              -- Clyde Haberman




--Apple-Mail-43-677722308
content-type: application/pgp-signature; x-mac-type=70674453;
	name=PGP.sig
content-description: This is a digitally signed message part
content-disposition: inline; filename=PGP.sig
content-transfer-encoding: 7bit

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)

iD8DBQFEVgdMzBwMl0DQ21gRAn32AJ98FlJcKxbBxi99Mu71qyWH34EsRACeIMhq
TdiV2h/pi3r+WKTYU5cevnI=
=CJr1
-----END PGP SIGNATURE-----

--Apple-Mail-43-677722308--