<dependency>
<groupId>org.jboss.remoting</groupId>
<artifactId>jboss-remoting</artifactId>
</dependency>
public interface RemoteService {
public String sayHello(String name) throws RemoteException;
}
public class RemoteServiceImpl implements RemoteService {
public String sayHello(String name) throws RemoteException {
return "Hello, " + name + "!";
}
}
public class Server {
public static void main(String[] args) {
try {
RemoteService service = new RemoteServiceImpl();
Endpoint.publish("http://localhost:8080/remoting", service);
System.out.println("Server started.");
} catch (Exception e) {
e.printStackTrace();
}
}
}
public class Client {
public static void main(String[] args) {
try {
URL url = new URL("http://localhost:8080/remoting?wsdl");
QName qname = new QName("http://impl.service.jbossservice", "RemoteServiceImplService");
Service service = Service.create(url, qname);
RemoteService remoteService = service.getPort(RemoteService.class);
String result = remoteService.sayHello("John");
System.out.println("Result: " + result);
} catch (Exception e) {
e.printStackTrace();
}
}
}
shell
keytool -genkeypair -alias server -keyalg RSA -keystore server.keystore
keytool -genkeypair -alias client -keyalg RSA -keystore client.keystore
<connector name="remoting-ssl" socket-binding="remoting-ssl" security-realm="ApplicationRealm">
<param key="keystore" value="server.keystore"/>
</connector>
<connector name="remoting-ssl" socket-binding="remoting-ssl">
<param key="truststore" value="client.keystore"/>
</connector>