It looks like you need these headers:
headers[‘X-LOOL-WOPI-IsModifiedByUser’] = isModifiedByUser;
headers[‘X-LOOL-WOPI-IsAutosave’] = isAutosave;
headers[‘X-LOOL-WOPI-IsExitSave’] = isExitSave;
@Alexandre I try to figure out how set the correct parameter and I wonder if I can use the WOPI PostMessage for this?
After I receifed the App_LoadingStatus during loading the document, I tried to send the request like this:
But this also does not have any effect.
From the description of this page it seems that setting forceSave should have effect, that I got the WOPI Post Request each time the user press the save button inside onlyOffice. But until now it did not work for me.
Can you give me a short example how to use the Command service to tell OnlyOffice to change its behaviour?
So I set both parameters to “0m”. The “step” parameter seems not to be documented - at least I did not found any information about it, but I think it should also be set to 0m too.
At least I did not understand why I should wait 1 or 5 minutes until my WOPI host receive the fresh document from the OnlyOffice documentServer.
I will try to explain the situation: We are developing an open source workflow suite (https://github.com/imixs/imixs-office-workflow). Users can create or process a process instance and can add any kind of information to it.
With the integration of OnlyOffice we want to offer our customers a way to edit documents via OnlyOffice. But from our Worklfow-perspective, the user can edit any kind of form data, add documents or at least edit existing documents with OnlyOffice.
When the user triggers the Workflow Action (e.g. save, approve, reject) we store all information including the documents into the workflow storage. The timestamp is an important data here. We generate a protocol over all data this user has added/changed. After a process step it may be that the workflow instance and all its data is now locked (e.g. archived) and it is not allowed any more to change it.
And for this reason I need the updated version from OnlyOffice immediately after the user clicks in OnlyOffice on the save button. Processing information depends on business rules within our BPMN process model and this is far outside of logic of the documentStorage from OnlyOffice.
I think from the perspective of OwnCloud or NextCloud the situation is much more easy and your idea to wait a little bit until all users have finished editing is fine. But in your workflow scenario it is not possible to change the document after the user has finished his task.
See the screen cast below for better understanding the situation:
function setOnlyOfficeForcesave() {
console.log('setOnlyOfficeForcesave.....');
var iframe = document.getElementById('wopi-iframe');
iframe = iframe.contentWindow || (iframe.contentDocument.document || iframe.contentDocument);
if (iframe) {
console.log('post message...');
iframe.postMessage(JSON.stringify({"c": "forcesave","key": "Khirz6zTPdfd7","userdata": "sample userdata"}), "*");
console.log('post message completed!');
} else {
console.log('iframe not found!');
}
}
The postMessage is executed without errors but I did not see any changes in behaviour.
I created a tar file from my documentserver logs. How can I provide you this file? I can not upload the file into this forum (?).
Probably you need to specify container name as you did it for DS:
container_name: imixs-documents
Or you need to resolve the situation in /etc/hosts file of DS container. Anyway this error looks like DNS issue.
Yes, I also have the impression that resolving the host names goes totally wrong. The supprising thing is, that OnlyOffice is of course able to call the checkFileInfo WOPI Call against "imixs-documents:8080/ and also fetch the file. This is expected in a docker-compose situation. But the nginx sever seems to try to resolve localhost:8080 which is the referer host when you have the perspective from the web application.
And this is the reason why I am missing a parameter to tell OnlyOffice (or the documentserver) the correct internal host name of my WOPI Host. Of course both docker containers can communicate with each other. And: everything is working with this development setup !? - very strange.
To describe the problem from a more broad perspective: I plan to setup the complete solution for our customers in Kubernetes. And also in this environment I expect that the document sever uses the internal POD host names provided by the internal Kubernetes network and not communicate via the official Internet DNS name. I expect the issue will be gone if I setup the connection via internet domains. But is it, what you expect/recommand? For the Web part with javascript in the browser I understand this. But for communication between documentserver and WOPI Host should it not be better to avoid going outside for security reason?
Maybe you can provide some architecture pictures to explain your ideal setup. This is also a interesting question, when my customer what to buy your Enterprise Solution. How should the setup look like in various scenarios?
How can I verify what happend on the server or if the command was successfull or not. I absolutily did not understand how to verifiy this.
Please be aware that I am running wopi_enabled=true mode
How can I verify what happend on the server or if the command was successfull or not.
You can check DEBUG logs on the Document server side to check it out. There will be PutFile request in the logs.
How to enable DEBUG logs:
Open /etc/onlyoffice/documentserver/log4js/production.json (for Docker - all actions performed inside the container);
Change “level”: “WARN” to “level”: “DEBUG”
Execute supervisorctl restart all to apply the changes
And also in this environment I expect that the document sever uses the internal POD host names provided by the internal Kubernetes network and not communicate via the official Internet DNS name
Here’s the official guide for Kubernetes:
Please note that we are still testing WOPI for K8s. We are going to add it as variable for pods in the next Helm Docs update.
Hi @Alexandre , I can activate the DEBUG mode. This works fine and I can see now many debug messages.
But my PostMessage did not work and also did not generate any additional debug message.
I analysed the situation in more detail. And maybe we are talking about different things.
Remember, I am in the WOPI Situation, which means my web application generates an iframe element to load the OnlyOffice editor based on the WOPI Discovery URL result. This works fine.
My iframe contains a document with again an iframe containing the OnlyOffice app.
Don’t you think, that my postMessage is going to the WOPI API and not to the command service?
This is the script I am using out from my web app to post the message:
function setOnlyOfficeForcesave() {
console.log('setOnlyOfficeForcesave.....');
var iframe = document.getElementById('wopi-iframe');
iframe = iframe.contentWindow || (iframe.contentDocument.document || iframe.contentDocument);
if (iframe) {
console.log('post message to localhost...');
//var result=iframe.postMessage(JSON.stringify({"c": "forcesave","key": "Khirz6zTPdfd7","userdata": "true"}), "*");
var result=iframe.postMessage(JSON.stringify({"c": "forcesave","key": "Khirz6zTPdfd7","userdata": "imixs-workflow"}), "http://localhost:80/coauthoring/CommandService.ashx");
console.log('post message completed! result='+result);
} else {
console.log('iframe not found!');
}
}
No errors, but I did not get a result (undefined) and I can’t see anything in the debug log.
Do you expect that in case of a WOPI integration it should be possible to post normal OnlyOffice Command Service in parallel to the WOP PostMessage commands? Even if they have different formats?
Hello @rsoika
Sorry for the late reply. Please accept our apologies for current situation. We are still working to improve WOPI on Document server.
As for forcesave scenario in general. There’s no desired mechanism for forcesave feature in WOPI at the moment. We are working on it.
There are only two ways to achieve desired scenario at the moment:
Switch WOPI to usage API.
Implement your own external Save button (not in the editor frame). This scenario should look like this: your server sends request to CommandService.ashx (ONLYOFFICE Api Documentation - Command service ) for checking file in Document server cache\build it\send to a storage.
Hi @Alexandre
thanks for your reply. No problem at all. If I know you are working on this it is fine. Can I track the issue on Github? Maybe I can also support your dev team with early testing.
For the moment I solved the problem somehow with the property settings for coauthoring:
But it is fine if you trigger me via this thread if a new version of the WOPI api is available. I prefer the WOPI API against the ONLYOFFICE API because an open standard protocol fits better in our own Open Source strategy.
Thank you for your testing offer, but I believe that our QA team deal with it. We have a lot of work to do to improve WOPI. I will notify you in this thread when we implement forcesave feature for WOPI.
As for autoAssembly parameter, as I mentioned before, this is not a right way in forcesave scenario (save button), but I understand why you looked at it in your scenario.
I will be in touch and provide you with any news about WOPI.