Thinkfree Office WOPI Setup Guide

Modified on Mon, 4 Aug at 5:34 PM

1. Overview

1.1 What is WOPI?


The Web Application Open Platform Interface Protocol (WOPI) is a standard communication protocol developed by Microsoft. It defines how a WOPI client—such as Thinkfree Office—interacts with a server (the WOPI Host) that stores and manages files. Thinkfree Office enables users to view and edit documents directly through a web browser, without needing to download them locally. This guide serves as a guide for implementing WOPI integration.


2. Setting

2.1 Thinkfree Office Server Setup


2.1.1 Configuring the hosting.war file

Move the hosting.war file from its current location --- which varies depending on the username (e.g. /home/thinkfree/thinkfree/weboffice/data/wo-server if username is thinkfree)to the ~/woServer directory.


[hancom@localhost ~]$ cp hosting.war ~/woServer


2.1.2 Change vhosts.conf file in httpd


/etc/httpd/conf.d/vhosts.conf file, change the contents as shown below. 


<VirtualHost*:80>
        Timeout 600
        KeepAlive On
        KeepAliveTimeout 75

        <Directory />
                <Limit PATCH DELETE OPTIONS>
                        Order deny,allow
                        Deny from all
                </Limit>
        </Directory>

        ServerName 127.0.0.1
        ServerAlias */cloud-office
        ServerAlias */hosting
        ServerAlias */webword
        ServerAlias */webCell
        ServerAlias */webShow

        ProxyPass /cloud-office ajp://127.0.0.1:8081/cloud-office
        ProxyPassReverse /cloud-office ajp://127.0.0.1:8081/cloud-office

        ProxyPass /hosting ajp://127.0.0.1:8081/hosting
        ProxyPassReverse /hosting ajp://127.0.0.1:8081/hosting

        ProxyPass /webword/connectToChannel ws://127.0.0.1:8080/webword/connectToChannel
        ProxyPassReverse /webword/connectToChannel ws://127.0.0.1:8080/webword/connectToChannel
        ProxyPass /webword ajp://127.0.0.1:8081/webword
        ProxyPassReverse /webword ajp://127.0.0.1:8081/webword

        ProxyPass /webCell/connectToChannel ws://127.0.0.1:8080/webCell/connectToChannel
        ProxyPassReverse /webCell/connectToChannel ws://127.0.0.1:8080/webCell/connectToChannel
        ProxyPass /webCell ajp://127.0.0.1:8081/webCell
        ProxyPassReverse /webCell ajp://127.0.0.1:8081/webCell

        ProxyPass /webShow/connectToChannel ws://127.0.0.1:8080/webShow/connectToChannel
        ProxyPassReverse /webShow/connectToChannel ws://127.0.0.1:8080/webShow/connectToChannel
        ProxyPass /webShow ajp://127.0.0.1:8081/webShow
        ProxyPassReverse /webShow ajp://127.0.0.1:8081/webShow
</VirtualHost>


2.1.3 wasserver settings

On the web application server, navigate to the ~/bin directory and restart the service with the following command:

[hancom@localhost bin]$ wasserver restart


3. Admin Page Settings

3.1 Admin Page Settings

(Capture the value set on the admin page)

On the admin page - Settings - Additional setting tab, click the +Add a row button to set the key value

Type adSettingUniAdapterActive and click the magnifying glass button shape.

Register that key value as true.


The wopiDiscovery value is also registered on the same page as above.

Below is an example of the wopiDiscovery xml value.


<wopi-discovery>
  <net-zone name="external-http">

    <!-- Writer documents -->
    <app favIconUrl="%%WOPI_FAVICON_URL_WORD%%" name="writer">
      <action default="true" ext="sxw" name="view" urlsrc="%%WOPI_DOMAIN_WORD%%/hosting/word_v.html"/>
      <action default="true" ext="odt" name="edit" urlsrc="%%WOPI_DOMAIN_WORD%%/hosting/word.html"/>
      <action default="true" ext="fodt" name="edit" urlsrc="%%WOPI_DOMAIN_WORD%%/hosting/word.html"/>
      <action default="true" ext="stw" name="view" urlsrc="%%WOPI_DOMAIN_WORD%%/hosting/word_v.html"/>
      <action default="true" ext="ott" name="view" urlsrc="%%WOPI_DOMAIN_WORD%%/hosting/word_v.html"/>
      <action default="true" ext="doc" name="edit" urlsrc="%%WOPI_DOMAIN_WORD%%/hosting/word_v.html"/>
      <action default="true" ext="dot" name="view" urlsrc="%%WOPI_DOMAIN_WORD%%/hosting/word_v.html"/>
      <action default="true" ext="docx" name="edit" urlsrc="%%WOPI_DOMAIN_WORD%%/hosting/word.html"/>
      <action default="true" ext="docm" name="edit" urlsrc="%%WOPI_DOMAIN_WORD%%/hosting/word.html"/>
      <action default="true" ext="dotx" name="view" urlsrc="%%WOPI_DOMAIN_WORD%%/hosting/word_v.html"/>
      <action default="true" ext="dotm" name="view" urlsrc="%%WOPI_DOMAIN_WORD%%/hosting/word_v.html"/>
      <action default="true" ext="wpd" name="view" urlsrc="%%WOPI_DOMAIN_WORD%%/hosting/word_v.html"/>
      <action default="true" ext="pdb" name="view" urlsrc="%%WOPI_DOMAIN_WORD%%/hosting/word_v.html"/>
      <default action="true" ext="hwp" name="view" urlsrc="%%WOPI_DOMAIN_WORD%%/hosting/word_v.html"/>
      <action default="true" ext="wps" name="view" urlsrc="%%WOPI_DOMAIN_WORD%%/hosting/word_v.html"/>
      <action default="true" ext="wri" name="view" urlsrc="%%WOPI_DOMAIN_WORD%%/hosting/word_v.html"/>
      <action default="true" ext="lrf" name="view" urlsrc="%%WOPI_DOMAIN_WORD%%/hosting/word_v.html"/>
      <action default="true" ext="mw" name="view" urlsrc="%%WOPI_DOMAIN_WORD%%/hosting/word_v.html"/>
      <action default="true" ext="rtf" name="edit" urlsrc="%%WOPI_DOMAIN_WORD%%/hosting/word.html"/>
      <action default="true" ext="txt" name="edit" urlsrc="%%WOPI_DOMAIN_WORD%%/hosting/word.html"/>
      <action default="true" ext="fb2" name="view" urlsrc="%%WOPI_DOMAIN_WORD%%/hosting/word_v.html"/>
      <action default="true" ext="cwk" name="view" urlsrc="%%WOPI_DOMAIN_WORD%%/hosting/word_v.html"/>
      <action default="true" ext="pages" name="view" urlsrc="%%WOPI_DOMAIN_WORD%%/hosting/word_v.html"/>
      <action default="true" ext="abw" name="view" urlsrc="%%WOPI_DOMAIN_WORD%%/hosting/word_v.html"/>
      <action default="true" ext="602" name="view" urlsrc="%%WOPI_DOMAIN_WORD%%/hosting/word_v.html"/>
    </app>

    <app name="writer-global">
      <action default="true" ext="sxg" name="view" urlsrc="%%WOPI_DOMAIN_WORD%%/hosting/word_v.html"/>
      <action default="true" ext="odm" name="edit" urlsrc="%%WOPI_DOMAIN_WORD%%/hosting/word.html"/>
      <action default="true" ext="otm" name="view" urlsrc="%%WOPI_DOMAIN_WORD%%/hosting/word_v.html"/>
    </app>

    <app name="writer-web">
      <action default="true" ext="oth" name="edit" urlsrc="%%WOPI_DOMAIN_WORD%%/hosting/word.html"/>
    </app>

    <!-- Calc documents -- >
    <app favIconUrl="%%WOPI_FAVICON_URL_CELL%%" name="calc">
      <action default="true" ext="sxc" name="view" urlsrc="%%WOPI_DOMAIN_CELL%%/hosting/spreadsheet_v.html"/>
      <action default="true" ext="ods" name="edit" urlsrc="%%WOPI_DOMAIN_CELL%%/hosting/spreadsheet.html"/>
      <action default="true" ext="fods" name="edit" urlsrc="%%WOPI_DOMAIN_CELL%%/hosting/spreadsheet.html"/>
      <action default="true" ext="stc" name="view" urlsrc="%%WOPI_DOMAIN_CELL%%/hosting/spreadsheet_v.html"/>
      <action default="true" ext="ots" name="view" urlsrc="%%WOPI_DOMAIN_CELL%%/hosting/spreadsheet_v.html"/>
      <action default="true" ext="xls" name="edit" urlsrc="%%WOPI_DOMAIN_CELL%%/hosting/spreadsheet.html"/>
      <action default="true" ext="xla" name="edit" urlsrc="%%WOPI_DOMAIN_CELL%%/hosting/spreadsheet.html"/>
      <action default="true" ext="XLTX" name="view" urlsrc="%%WOPI_DOMAIN_CELL%%/hosting/spreadsheet_v.html"/>
      <action default="true" ext="xltm" name="view" urlsrc="%%WOPI_DOMAIN_CELL%%/hosting/spreadsheet_v.html"/>
      <action default="true" ext="xlsx" name="edit" urlsrc="%%WOPI_DOMAIN_CELL%%/hosting/spreadsheet.html"/>
      <action default="true" ext="xlsb" name="edit" urlsrc="%%WOPI_DOMAIN_CELL%%/hosting/spreadsheet.html"/>
      <action default="true" ext="xlsm" name="edit" urlsrc="%%WOPI_DOMAIN_CELL%%/hosting/spreadsheet.html"/>
      <action default="true" ext="dif" name="edit" urlsrc="%%WOPI_DOMAIN_CELL%%/hosting/spreadsheet.html"/>
      <action default="true" ext="slk" name="edit" urlsrc="%%WOPI_DOMAIN_CELL%%/hosting/spreadsheet.html"/>
      <default action="true" ext="csv" name="edit" urlsrc="%%WOPI_DOMAIN_CELL%%/hosting/spreadsheet.html"/>
      <action default="true" ext="dbf" name="edit" urlsrc="%%WOPI_DOMAIN_CELL%%/hosting/spreadsheet.html"/>
      <action default="true" ext="wk1" name="view" urlsrc="%%WOPI_DOMAIN_CELL%%/hosting/spreadsheet_v.html"/>
      <action default="true" ext="gnumeric" name="view" urlsrc="%%WOPI_DOMAIN_CELL%%/hosting/spreadsheet_v.html"/>
      <action default="true" ext="numbers" name="view" urlsrc="%%WOPI_DOMAIN_CELL%%/hosting/spreadsheet_v.html"/>
    </app>

    <!-- Impress documents -->
    <app favIconUrl="%%WOPI_FAVICON_URL_SHOW%%" name="presentation">
      <action default="true" ext="sxi" name="view" urlsrc="%%WOPI_DOMAIN_SHOW%%/hosting/presentation_v.html"/>
      <action default="true" ext="odp" name="edit" urlsrc="%%WOPI_DOMAIN_SHOW%%/hosting/presentation.html"/>
      <action default="true" ext="fodp" name="edit" urlsrc="%%WOPI_DOMAIN_SHOW%%/hosting/presentation.html"/>
      <action default="true" ext="sti" name="view" urlsrc="%%WOPI_DOMAIN_SHOW%%/hosting/presentation_v.html"/>
      <action default="true" ext="otp" name="view" urlsrc="%%WOPI_DOMAIN_SHOW%%/hosting/presentation_v.html"/>
      <default action="true" ext="ppt" name="edit" urlsrc="%%WOPI_DOMAIN_SHOW%%/hosting/presentation.html"/>
      <default action="true" ext="pot" name="view" urlsrc="%%WOPI_DOMAIN_SHOW%%/hosting/presentation_v.html"/>
      <action default="true" ext="pptx" name="edit" urlsrc="%%WOPI_DOMAIN_SHOW%%/hosting/presentation.html"/>
      <action default="true" ext="pptm" name="edit" urlsrc="%%WOPI_DOMAIN_SHOW%%/hosting/presentation.html"/>
      <default action="true" ext="potx" name="view" urlsrc="%%WOPI_DOMAIN_SHOW%%/hosting/presentation_v.html"/>
      <action default="true" ext="potm" name="view" urlsrc="%%WOPI_DOMAIN_SHOW%%/hosting/presentation_v.html"/>
      <default action="true" ext="ppsx" name="edit" urlsrc="%%WOPI_DOMAIN_SHOW%%/hosting/presentation.html"/>
      <default action="true" ext="cgm" name="view" urlsrc="%%WOPI_DOMAIN_SHOW%%/hosting/presentation_v.html"/>
      <action default="true" ext="key" name="view" urlsrc="%%WOPI_DOMAIN_SHOW%%/hosting/presentation_v.html"/>
    </app>

    <!-- Capabilities -->
    <app name="Capabilities">
      <action ext="" name="getinfo" urlsrc="%%WOPI_DOMAIN%%/hosting/capabilities"/>
    </app>

  </net-zone>

  %%WOPI_PROOF_KEY%%
</wopi-discovery>

You can check the registered value on the admin page when registering the woipDiscovery value as follows, and when accessing /hosting/discovery after the was restart, you can see that the discovery.xml has been generated as follows:




When you access /hosting/discovery, a proof-key value is also generated at the bottom: The generated proof-key value is regenerated every 6 months. The generated values can also be found at their URLs and on the admin page.

Admin Page > Settings > Additional setting



Private key can only be found on that page. In order to link wopi with uniAdapter, you need to pass the generated wopiPrivateKey (Private Key) to Thinkfree and receive the adapter file. 

 

After receiving the adapter file, the following linkage is performed.

 

Register the adapter you received through the External Integration menu > the Adapter List tab > the Add Adapter button on the Administrator page>


entry

value

name

plain

class

com.tf.se.adapter.impl.uni.wopi.UniAdapter

explanation

Custom value (required value)

Adapter File

JAR file delivered from Thinkfree



Fill in the following and click the Register button.

After the registration is normal, the adapters registered in the list are displayed in the list.

Press the Appearance button of the registered adapter   to proceed with the setup as follows:



entry

value

Storage folder name

Empty Values

parameter

xt

Format

Empty Values


Write only the value of the parameter item in xt and press the save button.

When you're done, go to the UniAdpater Interface tab.

 

These tabs are divided into where to enter the WebOffice Sample URL at the top and interface settings.

First, enter the WebOffice Sample URL at the top. All URL Parameter values entered in the URL are stored in the AdapterParam object. Enter the values as follows:

https://[thinkfree server domain]/cloud-office/api/uni/{filename.extension}/open?docId={docId value of the document}&access_token={access_token value}


{} values, and then press the save button, you can see that the URL Parameter values are stored as AdapterParam objects, such as in the area at the bottom of url creation.



3.2 START Interface Settings

Then go to the Start interface tab at the bottom and enter additional parameter values required to open the document. The parameter values entered in the Start interface are also used as AdapterParam objects. Go to the Start tab and tap the enabled toggle to change it to unused. After that, enter the key value with key: access_token_ttl, press the Customization button to enter the access_token_ttl value, and then save.


3.3 INFO Interface Settings

Import document information from storage through API, extract file names and file sizes, and store them.

Method: GET / URL: 


https://[WOPI host domain]/wopi_thinkfree/files/{adapter.param.docId}?access_token={adapter.param.access_token}&access_token_ttl={adapter.param.access_token_ttl}


Header

{

  "Authorization": "Bearer {adapter.param.access_token}"

}



Type the following and tap the Send Request button. Call the API via the Send Request button, and the answered result is output at the bottom. After that, enter the name of the file you want to import through the Customization button in name, and enter the byte size of the document in size to save it.


Currently, the storage contains a header value that should be passed on API request, so it is not requested (improvement work is in progress), resulting in an error on request. For successful responses, you can save them as information imported from the response without directly entering the name and size, as shown below.



3.4 GET interface settings


binaryData key value to store the information in the document file to be imported.

 

Method: GET / URL: https://[WOPI HOST]/wopi_thinkfree/files/{adapter.param.docId}/contents?access_token={adapter.param.access_token}&access_token_ttl={adapter.param.access_token_ttl}


Header

{

  "Authorization": "Bearer {adapter.param.access_token}"

}


After that, click the Send Request button to save the binaryData value according to the response value.

Store > response > body .

Currently, the storage contains a header value that should be passed on API request, so it is not requested (improvement work is in progress), resulting in an error on request. For successful responses, you can save the binary data obtained through the response.



3.5 Setting Up the PUT Interface

Modify a document stored in Storage.


Method: POST / URL:

https://[WOPI Host domain]/wopi_thinkfree/files/{adapter.param.docId}/contents?access_token={adapter.param.access_token}&access_token_ttl={adapter.param.access_token_ttl}


Header

{

  "Authorization": "Bearer {adapter.param.access_token}",

  "Content-Type": "application/octet-stream",

  "X-WOPI-Override": "PUT"

}



After setting it up as follows, upload the changed file from the Upload File tab and click the Send Request button.



After that, when you press the save button, the contents of the changed file will be saved in storage. 

If you have completed the following settings, document opening should work normally.


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article