Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. package calculator.generic;
  2. import java.net.MalformedURLException;
  3. import java.net.URL;
  4.  
  5. import org.apache.xmlrpc.XmlRpcException;
  6. import org.apache.xmlrpc.client.XmlRpcClient;
  7. import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
  8.  
  9.  
  10. public class Client {
  11. public static void main(String[] args) throws XmlRpcException, MalformedURLException {
  12.  
  13.  
  14. //Configuration de la connexion au serveur
  15. XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
  16. config.setServerURL(new URL("http://127.0.0.1:8080"));
  17.  
  18. //Fourni les méthodes pour invoquer les méthodes distantes
  19. XmlRpcClient client = new XmlRpcClient();
  20. client.setConfig(config);
  21. //Appel de la méthode
  22. Object[] params = new Object[]{"Felix", "0101010101"};
  23. String entreeAnnuaire = (String) client.execute("Test.ajouterEntree", params);
  24. System.out.println(entreeAnnuaire);
  25.  
  26.  
  27. }
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement