Avatar
Please consider registering
guest
sp_LogInOut Log Insp_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 RSSsp_TopicIcon
How check if Endpoint is valid URI
June 22, 2021
17:16, EEST
Avatar
Sabari
Member
Members
Forum Posts: 62
Member Since:
June 21, 2021
sp_UserOfflineSmall Offline

Hello,

Is there a function in the sdk to check if an endpoint is a valid opc ua URI ?

Thanks

June 23, 2021
7:57, EEST
Avatar
Matti Siponen
Moderator
Members

Moderators
Forum Posts: 362
Member Since:
February 11, 2020
sp_UserOfflineSmall Offline

Hello,

You can use UaAddress.validate(String address). It will throw a URISyntaxException if the address isn’t valid.

June 23, 2021
17:43, EEST
Avatar
Sabari
Member
Members
Forum Posts: 62
Member Since:
June 21, 2021
sp_UserOfflineSmall Offline

Hello,
Thank you for your reply;

So when try UaAddress.validate(“something”) it not throw a URISyntaxException.

Is there another function ?

Thanks

June 24, 2021
10:08, EEST
Avatar
Matti Siponen
Moderator
Members

Moderators
Forum Posts: 362
Member Since:
February 11, 2020
sp_UserOfflineSmall Offline

Hello,

The UaAddress.validate method actually checks if a valid UaAddress could be parsed from a given String. For example, “something” can be parsed to “opc.tcp://something:4840”, which is a valid address. In a sense the method doesn’t actually validate whether or not the input String is a valid UaAddress, but whether or not the output of UaAddress.parse(String address) would be a valid UaAddress.

Is this method sufficient for your needs or would you need a method that takes a String as its input and determines without adding anything to it whether or not the String is a valid OPC UA URI?

June 24, 2021
11:21, EEST
Avatar
Sabari
Member
Members
Forum Posts: 62
Member Since:
June 21, 2021
sp_UserOfflineSmall Offline

Hello,

Yes i need a methode that takes a String as input and determines if this String is valid OPC UA URI.

June 24, 2021
13:27, EEST
Avatar
Matti Siponen
Moderator
Members

Moderators
Forum Posts: 362
Member Since:
February 11, 2020
sp_UserOfflineSmall Offline

Hello,

We’re considering adding such validation method to the SDK in future. In the meantime, you can validate that the OPC UA URI contains the following parts:

1. The identifier of a TransportProtocol, e.g.g “opc.tcp” for OPC UA TCP, followed by”://”
2. Hostname or IP address of the Server
3. “:” followed by the number of the port used by the Server
4. “/” followed by the Server Name

For example, “opc.tcp://MyHostName:12345/OPCUA/MyServer” is a valid OPC UA URI.

Validating identifiers of transport protocols is tricky, since new ones can be added to the specification in future. Instead, I would just check that the identifier belongs to any of the TransportProtocols supported by your application, which are probably OPC UA TCP and/or OPC UA HTTPS since you’re using the Prosys OPC UA SDK for Java.

Forum Timezone: Europe/Helsinki
Most Users Ever Online: 1919
Currently Online:
Guest(s) 66
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Heikki Tahvanainen: 402
hbrackel: 144
rocket science: 100
pramanj: 86
Francesco Zambon: 83
Ibrahim: 78
Sabari: 62
kapsl: 57
gjevremovic: 49
Xavier: 43
Member Stats:
Guest Posters: 0
Members: 773
Moderators: 7
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1558
Posts: 6567
Newest Members:
aracelyhaley4, raphaelschonell, Ashmag, kathyreimann56, brittanylemos, dorthycundiff76, PromotionToold, CHHinrichs, rodricklienhop, jose_Wanderlei
Moderators: Jouni Aro: 1039, Pyry: 1, Petri: 1, Bjarne Boström: 1054, Jimmy Ni: 26, Matti Siponen: 359, Lusetti: 0
Administrators: admin: 1