/* Simple exemple de client XmlRPC en Java
* utilisant le WebService AfficheIP
*
* http://www.afficheip.net
*/
import java.net.URL;
import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
import javax.swing.JOptionPane;
public class client
{
public static void main
(String[]args
)
{
try
{
XmlRpcClientConfigImpl config =
new XmlRpcClientConfigImpl
();
config.
setServerURL(new URL("http://www.afficheip.net/RPC"));
XmlRpcClient client =
new XmlRpcClient
();
client.
setConfig(config
);
/* Recupere l'adresse IP */
String ip =
(String) client.
execute("afficheip.getIP",
new Object[]{});
JOptionPane.
showMessageDialog(null,
"IP : " + ip
);
/* Recupere l'host */
String host =
(String) client.
execute("afficheip.getHOST",
new Object[]{});
JOptionPane.
showMessageDialog(null,
"HOST : " + host
);
}
catch( Exception e
){}
}
}