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
Synchronize files between client and server
August 24, 2016
17:05, EEST
Avatar
SebastianGrueb
New Member
Members
Forum Posts: 2
Member Since:
August 24, 2016
sp_UserOfflineSmall Offline

Hi,
I am trying to synchronize files between client and server (using the SampleConsoleClient(-Server) with the FileNodeManager and the FileSyncClient
The files on the server get synchronized to the client, but the files on the client don’t get synchronized to the server.
Furthermore the client tries to synchronize the received files from the server back to the server.
————————————————-
ClientCode:
protected void loadFile(NodeId nodeId) {
FileSyncClient fileSync = new FileSyncClient(client);
try {
fileSync.addSyncedFolder(nodeId, System.getProperty(“user.dir”) + “/FileFolder/Client”,
FileSyncClient.SyncFolderDirection.ReadWrite);
} catch (Exception e) {
e.printStackTrace();
}
fileSync.setMonitorInterval(1000);
}
————————————————-
fileSync.addFile throws the same exception as the stack-trace below
————————————————-
ServerCode:
private void createFileNodeManager() throws StatusException {
// TODO
fileNodeManager = new FileNodeManager(getServer(), “http://prosysopc.com/OPCUA/FileTransfer”, “Files”);
getServer().getNodeManagerRoot().getObjectsFolder().addReference(fileNodeManager.getRootFolder(), Identifiers.Organizes, false);
fileNodeManager.setAllowWrite(true);
fileNodeManager.setMonitoringInterval(1000);
File serverFileFolder = new File(System.getProperty(“user.dir”) + “/FileFolder/Server”);
FileFolderType folder = fileNodeManager.addFolder(serverFileFolder);
fileNodeManager.startMonitoring();
}
————————————————-
Adding files to FileFolderType folder with folder.addFile…. doesn’t work either (addFile returns false, no exception is thrown)
————————————————-

08/24/2016 15:43:52.031 INFO Failed to synchronize local file to remote. File=C:\Users\Me\workspace_fileSystem\Prosys-OPC-UA-Java-SDK-Client-Server-Binary-2.2.2-638\FileFolder\Client\Server Exception=com.prosysopc.ua.ServiceException: ServiceFault: Bad_ServiceUnsupported (0x800B0000) “The server does not support the requested service.”
Diagnostic Info: ServiceResult=Bad_ServiceUnsupported (0x800B0000) “The server does not support the requested service.”
com.prosysopc.ua.ServiceException: ServiceFault: Bad_ServiceUnsupported (0x800B0000) “The server does not support the requested service.”
Diagnostic Info: ServiceResult=Bad_ServiceUnsupported (0x800B0000) “The server does not support the requested service.”
at com.prosysopc.ua.client.AddressSpace.addNodes(Unknown Source)
at com.prosysopc.ua.client.AddressSpace.addNode(Unknown Source)
at com.prosysopc.ua.client.FileSyncClient.addFile(Unknown Source)
at com.prosysopc.ua.client.FileSyncClient.a(Unknown Source)
at com.prosysopc.ua.client.FileSyncClient.sync(Unknown Source)
at com.prosysopc.ua.client.FileSyncClient$1.run(Unknown Source)
at java.util.TimerThread.mainLoop(Unknown Source)
at java.util.TimerThread.run(Unknown Source)

Thanks in advance

August 25, 2016
11:18, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1010
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Yes, the server does not enable AddNodes service by default, which is required for the client to be able to add new FileType nodes in the server.

To enable it in your server, use

server.getAddressSpace().setNodeManagementEnabled(true);

You may further limit the adding using the NodeManagerListener in each NodeManager, if necessary.

Note that synchronising files is rather complex in practice due to the file system issues, and the SDK objects are not 100% accurate in noticing changes in the files and synchronising them. But, go ahead experimenting and seeing how it works in practice for you.

In general, the synchronisation from the server to the client should be more reliable.

And feel free to keeping us up to date how it works for you.

August 25, 2016
12:53, EEST
Avatar
SebastianGrueb
New Member
Members
Forum Posts: 2
Member Since:
August 24, 2016
sp_UserOfflineSmall Offline

Thank you very much, that and the right path notation ( backslash instead of forward slash) fixed my problem so far.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 518

Currently Online:
18 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 135

pramanj: 86

Francesco Zambon: 81

rocket science: 77

Ibrahim: 76

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

fred: 41

Member Stats:

Guest Posters: 0

Members: 682

Moderators: 16

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1467

Posts: 6261

Newest Members:

digitechroshni, LouieWreve, Kickbiche, karrimacvitie5, graciela2073, sagarchau, elviralangwell4, Donnavek, Eddiefauth, DonaldPooma

Moderators: Jouni Aro: 1010, Otso Palonen: 32, Tuomas Hiltunen: 5, Pyry: 1, Petri: 0, Bjarne Boström: 983, Heikki Tahvanainen: 402, Jukka Asikainen: 1, moldzh08: 0, Jimmy Ni: 26, Teppo Uimonen: 21, Markus Johansson: 42, Niklas Nurminen: 0, Matti Siponen: 321, Lusetti: 0, Ari-Pekka Soikkeli: 5

Administrators: admin: 1