Wednesday, November 12, 2008

Fetching Property Files Using Resource Bundle

Put the property Files in the classpath ,which contains key value pairs.
If the files are putin any other location thean classpath , give the path in tomcat or next to the bootstrap jar listing.
Now access the files as accessing any other Bundle
ResourceBundle myResources = ResourceBundle.getBundle("propertfilename");
Then u can do a bundle.getValue() to the required key value pair.


Apache XML-RPC is a Java implementation of XML-RPC, a popular protocol that uses XML over HTTP to implement remote procedure calls.
1.Client class
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
config.setServerURL(new URL(""));
XmlRpcClient client = new XmlRpcClient();
Object[] params = new Object[]{new Integer(33), new Integer(9)};
Integer result = (Integer) client.execute("Calculator.add", params);

2.Server Class
public class Calculator {
public int add(int i1, int i2) {
return i1 + i2;
public int subtract(int i1, int i2) {
return i1 - i2;

3. Create Propert File
Create a property file, which contains at least one property. The property name is arbitrary, and the property value is the fully qualified name of the Calculator class. For example, like that:
The property file must be called, and it must be located in the package org.apache.xmlrpc.webserver. In other words, you would typically put it into the directory org/apache/xmlrpc/webserver and add it to your jar file.

4. Add Entry to Web.xml
<servlet-name> XmlRpcServlet</servlet-name>
<description> Sets, whether the servlet supports vendor extensions for XML-RPC. </description>

XStream - Convert XMl to Java & Vice Versa

XStream is a simple library to serialize objects to XML and back again.
XStream xstream = new XStream();
Person joe = new Person("Joe", "Walnes");
String xml = xstream.toXML(joe)
The resulting XML looks like this:
Deserializing an object back from XML
Person newJoe = (Person)xstream.fromXML(xml);
Reference :

Free Domain Names @!