task 2 may be done.

This commit is contained in:
2025-12-21 21:30:45 +01:00
parent 5141562548
commit e8f1271f06
3 changed files with 41 additions and 2 deletions

View File

@@ -18,6 +18,9 @@ import org.apache.xmlrpc.*;
import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
// logging
import org.apache.xmlrpc.client.XmlRpcCommonsTransportFactory;
public class Client {
private static String TAG = "Client";
@@ -25,15 +28,21 @@ public class Client {
public static void main(String[] args) {
try (Scanner scanner = new Scanner(System.in)) {
// create an XML-RPC client object with address to server @ localhost
// URL can be any valid URL. the default port for XML-RPC is 80
// but here we use 8080 since 80 may need root privileges
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
config.setServerURL(new URL("http://localhost:8080/RPC2"));
config.setServerURL(URI.create("http://localhost:8080/RPC2").toURL());
XmlRpcClient client = new XmlRpcClient();
client.setConfig(config);
// Logging of XML-RPC messages between server and client
XmlRpcCommonsTransportFactory factory = new XmlRpcCommonsTransportFactory(client);
// enable logging
factory.setEnableLogging(true);
client.setTransportFactory(factory);
while (true) {
// create parameters to be sent to server method in a vector
// and populate it

View File

@@ -14,6 +14,11 @@ import java.net.URL;
import org.apache.xmlrpc.server.PropertyHandlerMapping;
import org.apache.xmlrpc.server.XmlRpcServer;
// logging imports
import java.util.logging.ConsoleHandler;
import java.util.logging.Level;
import java.util.logging.Logger;
public class Server {
private static String TAG = "Server";