4

I'm trying to get Wopi host implementation in Ruby on Rails application.

My domain is whitelisted under CSPP. Trying to get the file contents in iframe, but I just see "Word Online" and a loading gif, I return binary file contents of docx as response to ..wopi/files/:id/contents. I don't get any calls hitting my host server.

Sample wopi_src_url: https://word-view.officeapps-df.live.com/wv/wordviewerframe.aspx?ui=1033&rs=1033&dchat=false&IsLicensedUser=0&WOPISrc=https://sgdevwopi.test-wopi.sycamoreinformatics.com/wopi/files/31/contents?access_token=eyJhbGciOiJIUzI1NiJ9.eyJ1c2&access_token_ttl=160000000

enter image description here

Able to get the Wopi validation page in Iframe using .wopitest file. How should I proceed further? Or what am I missing? Please help.

Note: I'm using ngrok to make my local app server visible publicly with whitelisted domain.

Suhas Giriraj
  • 242
  • 2
  • 11

1 Answers1

3

I see to problems with your URL. You must ensure that

  • the URL is of the form http://server/<...>/wopi/files/(file_id) (so drop the /contents part - WOPI client will call the /contents endpoint automatically when necessary)
  • the WOPISrc parameter value is encoded to a URL-safe string

More info here and here.

rocky
  • 7,506
  • 3
  • 33
  • 48
  • Thanks @rocky it worked!! :) Able to view docx files now. – Suhas Giriraj Apr 25 '18 at 11:50
  • @rocky check this same issue but using .net https://stackoverflow.com/questions/56585168/wopi-host-implementation-trying-to-render-doc-in-iframe-asp-net-mvc – ZCoder Jun 13 '19 at 16:48
  • I will, in a few days – rocky Jun 14 '19 at 08:06
  • @rocky do you mean no need to use the /contents endPoint in the host page? what about other endPoints like lock PUT etc .. ? – Rebai Ahmed Feb 27 '23 at 13:49
  • You have to implement at least the [GET /contents endpoint](https://learn.microsoft.com/en-us/microsoft-365/cloud-storage-partner-program/rest/files/getfile#getfile) on the WOPI host side. However, you shouldn't put `/contents` in the host pages's source URL. Locks are required only for editing - https://learn.microsoft.com/en-us/microsoft-365/cloud-storage-partner-program/rest/files/lock – rocky Feb 27 '23 at 14:01