//创建服务端
public class XmlrpcServer {
protected static Logger logger = LoggerFactory.getLogger(XmlrpcServer.class);
public static void monitorPython() throws Exception{
WebServer webServer=new WebServer(端口号);
XmlRpcServer xmlRpcServer=webServer.getXmlRpcServer();
PropertyHandlerMapping phm=new PropertyHandlerMapping();
phm.addHandler("stationHandler",StationHandler.class);
xmlRpcServer.setHandlerMapping(phm);
XmlRpcServerConfigImpl config=(XmlRpcServerConfigImpl)xmlRpcServer.getConfig();
config.setContentLengthOptional(false);
config.setEnabledForExtensions(true);
config.setKeepAliveEnabled(true);
webServer.start();
}
}
//创建处理器,给服务端调用
public class StationHandler{
//对外提供远程调用的方法
public String handTest(String msg) {
system out println("xmlrpc测试方法被调用");
}
}