18:50, EEST
October 26, 2016
Good afternoon.
First of all, sorry but I am a novice in all that relates to OPC servers and connections.
I’m trying to connect to Matrikon OPC Server that I have installed and running in a virtual machine, and the same try to connect from the Java SDK against Matrikon server, but i can not.
The next example code (seemingly simple), returns next error on line “client.connect()”: “Failed to retrieve endpoints The server is not available. Opc.tcp: // localhost: 4841 ServiceResult = Bad_ConnectionRejected (0x80AC0000)” Could not Establish a network connection to remote server. “
Could you help to establish the connection via OPC-UA? On the other hand, is it possible other type of connection to a server using OPC UA, like HTTP SOAP requests, insted “opc.tcp”?
Code:
import java.io.IOException;
import java.net.UnknownHostException;
import java.util.Locale;
import org.opcfoundation.ua.builtintypes.DataValue;
import org.opcfoundation.ua.builtintypes.LocalizedText;
import org.opcfoundation.ua.core.ApplicationDescription;
import org.opcfoundation.ua.core.ApplicationType;
import org.opcfoundation.ua.core.Identifiers;
import org.opcfoundation.ua.transport.security.SecurityMode;
import com.prosysopc.ua.ApplicationIdentity;
import com.prosysopc.ua.SecureIdentityException;
import com.prosysopc.ua.client.UaClient;
public class SimpleClient {
public static void main(String[] args) throws Exception {
UaClient client = new UaClient(“opc.tcp://localhost:4841”);
client.setSecurityMode(SecurityMode.NONE);
initialize(client);
client.connect();
DataValue value = client.readValue(Identifiers.Server_ServerStatus_State);
System.out.println(value);
client.disconnect();
}
protected static void initialize(UaClient client)
throws SecureIdentityException, IOException, UnknownHostException {
ApplicationDescription appDescription = new ApplicationDescription();
appDescription.setApplicationName(new LocalizedText(“SimpleClient”, Locale.ENGLISH));
appDescription.setApplicationUri(“urn:localhost:UA:SimpleClient”);
appDescription.setProductUri(“urn:prosysopc.com:UA:SimpleClient”);
appDescription.setApplicationType(ApplicationType.Client);
final ApplicationIdentity identity = new ApplicationIdentity();
identity.setApplicationDescription(appDescription);
client.setApplicationIdentity(identity);
}
}
Thank you very much.
18:54, EEST
December 21, 2011
10:03, EEST
October 26, 2016
Most Users Ever Online: 1919
Currently Online:
23 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Heikki Tahvanainen: 402
hbrackel: 144
rocket science: 88
pramanj: 86
Francesco Zambon: 83
Ibrahim: 78
Sabari: 62
kapsl: 57
gjevremovic: 49
Xavier: 43
Member Stats:
Guest Posters: 0
Members: 736
Moderators: 7
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1524
Posts: 6453
Newest Members:
rickie5305, shaylamaggard4, rickyjuarez140, jonathonmcintyre, fannielima, kristiewinkle8, rust, christamcdowall, redaahern07571, nigelbdhmpModerators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1027, Jimmy Ni: 26, Matti Siponen: 346, Lusetti: 0
Administrators: admin: 1