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: 1026
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: 1919

Currently Online:
20 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: 730

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1529

Posts: 6471

Newest Members:

PromotionToold, HypromeImpupe, toneylapham544, rondawolinski7, Marypof5711, roycedelargie91, kourtneyquisenbe, ellis87832073466, zkxwilliemae, gabriellabachus

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

Administrators: admin: 1