Hi there…
I am trying to get basic RPC functionality from the client to the gateway.
I have setup my RPC code as set out in the Programmers guide .
In both projects (client, gateway) there is a copy of the ModuleRPC interface.
[code]package com.versata.gblocks.common;
public interface ModuleRPC {
String getGreeting(String firstName);
}
[/code]
In the Gateway project is the implementation:
[code]package com.versata.gblocks.gateway;
import com.versata.gblocks.common.ModuleRPC;
public class ModuleRPCImpl implements ModuleRPC {
public String getGreeting(String firstName){
return "Hello, " + firstName;
}
}[/code]
In the Gateway hook:
[code]package com.versata.gblocks.gateway;
import com.inductiveautomation.ignition.common.licensing.LicenseState;
import com.inductiveautomation.ignition.gateway.clientcomm.ClientReqSession;
import com.inductiveautomation.ignition.gateway.model.AbstractGatewayModuleHook;
import com.inductiveautomation.ignition.gateway.model.GatewayContext;
public class GatewayHook extends AbstractGatewayModuleHook {
@Override
public void setup(GatewayContext context) {
// TODO Write code, override methods as needed
}
@Override
public void shutdown() {
}
@Override
public void startup(LicenseState licenseState) {
}
@Override
public Object getRPCHandler(ClientReqSession session, Long projectId) {
return new ModuleRPCImpl();
}
}
[/code]
In the client code at the end of the constructor:
ModuleRPC rpc = ModuleRPCFactory.create("com.versata.gblocks.gateway.ModuleRPCImpl'", ModuleRPC.class);
System.out.println( rpc.getGreeting("Bill") );
However in the Designer I get the following compact error:
[quote]SerializationException: Error deserializing element “<c”
caused by UndeclaredThrowableException
caused by GatewayException: Module “com.versata.gblocks.gateway.ModuleRPCImpl’” not found.
caused by IllegalArgumentException: Module “com.versata.gblocks.gateway.ModuleRPCImpl’” not found.
[/quote]
I copied the example directly but then was getting an error with the code from the example:
ModuleRPC rpc = ModuleRPCFactory.create(ModuleMeta.MODULE_ID, ModuleRPC.class);
System.out.println( rpc.getGreeting("Bill") );
Where it complained about the function getGreeting(String)
not existing in an alarm module com.inductiveautomation.alarm-notification
.
So I changed the code to the implementation given first.
Is there anything obvious I have missed.
I just want to finish setting up the basics, so I can move on to the nitty gritty .
Any help will be appreciated .