I am using below code to make the connection from UTGARD to Kepware V6 OPC DA.
package com.flutura.openscada.tutorial;
import java.util.concurrent.Executors;
import java.util.logging.Logger;
import org.jinterop.dcom.common.JIException;
import org.openscada.opc.lib.common.ConnectionInformation;
import org.openscada.opc.lib.da.AccessBase;
import org.openscada.opc.lib.da.DataCallback;
import org.openscada.opc.lib.da.Item;
import org.openscada.opc.lib.da.ItemState;
import org.openscada.opc.lib.da.Server;
import org.openscada.opc.lib.da.SyncAccess;
public class UtgardTutorial1 {
public static void main(String[] args) throws Exception {
// create connection information
final ConnectionInformation ci = new ConnectionInformation();
ci.setHost("localhost");
ci.setDomain("");
ci.setUser("");
ci.setPassword("");
ci.setProgId("Kepware.KEPServerEX.V6\\Simulation Examples.Functions.Ramp1");
//ci.setProgId("SWToolbox.TOPServer.V5");
ci.setClsid("7BC0CC8E-482C-47CA-ABDC-0FE7F9C6E729"); // if ProgId is not working, try it using the Clsid instead
final String itemId = "_System._Time_Second";
// create a new server
System.out.println("Server1");
final Server server = new Server(ci, Executors.newSingleThreadScheduledExecutor());
System.out.println("Server1 =>" + server);
try {
server.connect();
final AccessBase access = new SyncAccess(server, 500);
access.addItem(itemId, new DataCallback() {
@Override
public void changed(Item item, ItemState state) {
System.out.println("Data change " + item + " : " + state);
}
});
access.bind();
Thread.sleep(10 * 1000);
access.unbind();
} catch (final JIException e) {
System.out.println("Errorrrrrrrr : " + String.format("%08X: %s", e.getErrorCode(), server.getErrorMessage(e.getErrorCode())));
} catch (Exception ex) {
System.out.println("Errorrrrrrrr : " + ex.getMessage());
}
}
}
I want to fetch data for my all the parameters in IOT Gateway from kepServer,
But to test it I have mentioned only one parameter name => Simulation Examples.Functions.Ramp1
And I am getting output like this
Server1
Server1 =>org.openscada.opc.lib.da.Server@724af044
Sep 18, 2018 12:51:22 PM rpc.DefaultConnection processOutgoing
INFO:
Sending BIND
Sep 18, 2018 12:51:22 PM rpc.DefaultConnection processIncoming
INFO:
Recieved BIND_ACK
Sep 18, 2018 12:51:22 PM rpc.DefaultConnection processOutgoing
INFO:
Sending AUTH3
Sep 18, 2018 12:51:23 PM rpc.DefaultConnection processOutgoing
INFO:
Sending ALTER_CTX
Sep 18, 2018 12:51:23 PM rpc.DefaultConnection processIncoming
INFO:
Recieved ALTER_CTX_RESP
Sep 18, 2018 12:51:23 PM rpc.DefaultConnection processOutgoing
Errorrrrrrrr : 00000005: Unknown error (00000005)
INFO:
Sending REQUEST
Sep 18, 2018 12:51:23 PM rpc.DefaultConnection processIncoming
INFO:
Recieved FAULT
I am new to UTGARD code. I am not able to understand what is wrong in the code and why this error:
00000005: Unknown error (00000005)