Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
Connect to Matrikon OPC Server by OPC-UA
October 26, 2016
18:50, EEST
Avatar
mgonzalezi
Member
Members
Forum Posts: 3
Member Since:
October 26, 2016
sp_UserOfflineSmall Offline

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.

October 26, 2016
18:54, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1026
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Please, verify the server address. Looks like the client cannot open the connection to port 4841 at all.

October 27, 2016
10:03, EEST
Avatar
mgonzalezi
Member
Members
Forum Posts: 3
Member Since:
October 26, 2016
sp_UserOfflineSmall Offline

Hello.

Could you guide me on how to verify the actual address of the server? Keep in mind that I am doing everything on the same machine, but not sure how to check the server port Matrikon OPC Server?

Thanks!

October 27, 2016
10:27, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1026
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

You need to check it from Matrikon documentation. I don’t know that product so well.

October 27, 2016
16:41, EEST
Avatar
mgonzalezi
Member
Members
Forum Posts: 3
Member Since:
October 26, 2016
sp_UserOfflineSmall Offline

Thats ok, thanks Jouni!

Forum Timezone: Europe/Helsinki

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, nigelbdhmp

Moderators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1027, Jimmy Ni: 26, Matti Siponen: 346, Lusetti: 0

Administrators: admin: 1