You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@ws.apache.org by Dave Kelly <da...@samsungcontact.com> on 2002/10/03 14:10:57 UTC

Specifying parameter types other than string

Hello,

I am currently writing an XML-RPC client which needs to supply named 
parameters of a type other than string.

I have a Hashtable containing the names and parameter values set up as 
follows:

         htParms.put("username", (String)props.get("user-name"));
         htParms.put("password", (String)props.get("password"));

I then add that Hashtable to the Vector which I pass to the execute 
method of XmlRpcClient.

What happens when I want to specify a boolean for example ? I can't use:

         htParms.put("secure", false);

as the put method of Hashtable doesn't allow it.

Any help is appreciated.

Cheers

Dave Kelly




Re: Specifying parameter types other than string

Posted by cyrille <cy...@kbuilder.net>.
>
>
>>> What happens when I want to specify a boolean for example ? I can't 
>>> use:
>>>
>>>         htParms.put("secure", false);
>>>
>>> as the put method of Hashtable doesn't allow it. 
>>
>>
>>
>>
>> htParms.put("secure", new Boolean(false) );
>>
>> isn't it ?
>>
>> cyrille
>>
> That did the trick. 


not a xml-rpc spec, it's a Java behavior !

java.util.hashtable works with object (Boolean, Integer, MyClass), not 
with primitive (boolean, int)

cyrille



Re: Specifying parameter types other than string

Posted by cyrille <cy...@kbuilder.net>.
>
>
>>> What happens when I want to specify a boolean for example ? I can't 
>>> use:
>>>
>>>         htParms.put("secure", false);
>>>
>>> as the put method of Hashtable doesn't allow it. 
>>
>>
>>
>>
>> htParms.put("secure", new Boolean(false) );
>>
>> isn't it ?
>>
>> cyrille
>>
> That did the trick. 


not a xml-rpc spec, it's a Java behavior !

java.util.hashtable works with object (Boolean, Integer, MyClass), not 
with primitive (boolean, int)

cyrille



Re: Specifying parameter types other than string

Posted by Dave Kelly <da...@samsungcontact.com>.
cyrille wrote:

>> What happens when I want to specify a boolean for example ? I can't use:
>>
>>         htParms.put("secure", false);
>>
>> as the put method of Hashtable doesn't allow it. 
>
>
>
> htParms.put("secure", new Boolean(false) );
>
> isn't it ?
>
> cyrille
>
You're too kind :-)

That did the trick.



Re: Specifying parameter types other than string

Posted by Dave Kelly <da...@samsungcontact.com>.
cyrille wrote:

>> What happens when I want to specify a boolean for example ? I can't use:
>>
>>         htParms.put("secure", false);
>>
>> as the put method of Hashtable doesn't allow it. 
>
>
>
> htParms.put("secure", new Boolean(false) );
>
> isn't it ?
>
> cyrille
>
You're too kind :-)

That did the trick.



Re: Specifying parameter types other than string

Posted by Daniel Rall <dl...@finemaltcoding.com>.
cyrille <cy...@kbuilder.net> writes:

> > What happens when I want to specify a boolean for example ? I can't use:
> >
> >         htParms.put("secure", false);
> >
> > as the put method of Hashtable doesn't allow it.
> 
> htParms.put("secure", new Boolean(false) );

Or more efficiently:

  htParms.put("secure", Boolean.FALSE);

-- 

Daniel Rall <dl...@finemaltcoding.com>

Re: Specifying parameter types other than string

Posted by Daniel Rall <dl...@finemaltcoding.com>.
cyrille <cy...@kbuilder.net> writes:

> > What happens when I want to specify a boolean for example ? I can't use:
> >
> >         htParms.put("secure", false);
> >
> > as the put method of Hashtable doesn't allow it.
> 
> htParms.put("secure", new Boolean(false) );

Or more efficiently:

  htParms.put("secure", Boolean.FALSE);

-- 

Daniel Rall <dl...@finemaltcoding.com>

Re: Specifying parameter types other than string

Posted by cyrille <cy...@kbuilder.net>.
> What happens when I want to specify a boolean for example ? I can't use:
>
>         htParms.put("secure", false);
>
> as the put method of Hashtable doesn't allow it. 


htParms.put("secure", new Boolean(false) );

isn't it ?

cyrille


Re: Specifying parameter types other than string

Posted by cyrille <cy...@kbuilder.net>.
> What happens when I want to specify a boolean for example ? I can't use:
>
>         htParms.put("secure", false);
>
> as the put method of Hashtable doesn't allow it. 


htParms.put("secure", new Boolean(false) );

isn't it ?

cyrille