Building an Office Web Apps (OWA) WOPI Host

This solution gives you a simple WOPI Host that provides viewing, and editing through Office Web Apps via a custom WOPI Server. Illustrates the implementation of WOPI for a Server in a working example.

C# (2.7 MB)
 
 
 
 
 
(12)
3,914 times
Add to favorites
10/15/2015
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • WOPI: Could not deserialize file metadata
    1 Posts | Last post January 16, 2016
    • Hi Shawn,
      
      I've been looking for a online word editing in a browser and came across your solution. 
      
      In my log files I see the following error, how can I rectify this error?. 
      WOPI: Could not deserialize file metadata  
      WOPI: Invalid file metadata
      
      I've been struggling to find an answer for this for past one week, if you can shed any light for this problem that would be wonderful and appreciate it.
      
      Thanks
      John
  • Always getting error
    7 Posts | Last post January 15, 2016
    • Sorry, there was a problem and we can't open this document.  If this happens again, try opening the document in Microsoft Word.
      Any ideas?
      Logs: 
      WOPI: Could not deserialize file metadata [url:http://edv05wopi/wopi/files/test2.docx, e:There was an error deserializing the object of type Microsoft.Office.OpenWebApplication.WopiCheckFileResponse. Encountered unexpected character 'P'.]	36e24a4a-e7a3-4e67-aa59-aea55c224336
      WOPI: Invalid file metadata [url:http://edv05wopi/wopi/files/test2.docx, triggers:(No Hash No Version No FileName No OwnerId), data:PK          !  $���   �       [Content_Types].xml �  (�                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ��MO�@ ��&� �W �z0Ɣ����M��.C��~dg��� JK���Z���2��� 3��J�� <*kR�Oz, #m��,e�����E ��Di �l �F�ˋ�t� #�6...	36e24a4a-e7a3-4e67-aa59-aea55c224336
    • Does it happen with all files or just 1.  Is this using the sample solution that was provided?
    • office web apps servers preview pdf on custom system?
    • Write their own project called office web apps preview PDF server, what do you want to configure, and what pay attention to the url format?
    • Roberto/Shawn,
      
      I am able to render text file data but for word data I see exactly the same response as mentioned by Roberto for word data in my custom WOPI client.
      
      What was the solution that you found?
      
    • Can you clarify? You have a custom WOPI Client and you're NOT using Office Web Apps?  If true, then what you're seeing is an OpenXML document "binary" stream. 
      
      A WOPI server's responsibility is to return a binary stream, not handle the editing.  It is properly returning an OpenXML (docx) file to the WOPI Client (yours).  That stream you're getting, prefixed with PK - is an OpenXML document.  
      
      The WOPI client must then decide what to do with that binary stream.  If it's OpenXML, OWA can handle it. If it's a custom WOPI client, then you'd have to interpret OpenXML.
    • Hi Shawn,
      
      I'm using your latest solution. the Word Web App tries to load it, but it throwing an error. In the log file I got the same error message as specified by Roberto. How can I resolve this issue? 
      
      Thank you!!
  • PPT edition issue (cache)
    1 Posts | Last post December 18, 2015
    • Hi all,
      
      I took this project as an example to implement mine using WebAPI. However, i'm having some issues trying to edit PowerPoint files. In example:
      
      - I open file A.pptx and take it in view mode
      - Click on "Edit in browser" button and file opens in edit mode correctly.
      - Then, open file B.pptx in view mode.
      - Click on "Edit in browser" button and OWA opens file A.pptx contents in edit mode but using file B.pptx properties.
      
      I think it's some related with cache but I cannot solve it.
      
      Any help will be appreciated.
      
      Regards,
      
      Brian.
  • http://owa1.wingtip.com/we/wordeditorframe.aspx? not able to access
    1 Posts | Last post November 16, 2015
    • I've tried to run it and Open test document.docx to edit and it showed me:
      "The requested URL could not be retrieved
      
      
      While trying to retrieve the URL: http://owa1.wingtip.com/we/wordeditorframe.aspx? 
      
      The following error was encountered: 
      
      Unable to determine IP address from host name for owa1.wingtip.com 
      
      The dnsserver returned: 
      
      Name Error: The domain name does not exist. 
      
      This means that: 
       The cache was not able to resolve the hostname presented in the URL. 
       Check if the address is correct. 
      "
       As mentioned in below thread, I need to have host entry -" host entries in your /etc/hosts file, which is in c:\windows\system32\drivers\etc" 
      
      Can you please show me which entry need to do?
      
  • still error
    2 Posts | Last post October 11, 2015
    • Hi, I have did all things but still go wrong when CheckFileInfo called. here is my error messages taken from owa logs:
      
      10/10/2015 20:22:37.50 	w3wp.exe (0x1F14)                       	0x0FDC	Office Web Apps               	WAC Hosting Interaction       	adhsg	Monitorable	WOPI: Could not deserialize file metadata [url:http://10.1.139.234/api/wopi/files/test.docx, e:Expecting state 'Element'.. Encountered 'Text'  with name '', namespace ''. ]	b8317122-6964-4208-97a0-e89b702e61ac
      10/10/2015 20:22:37.50 	w3wp.exe (0x1F14)                       	0x0FDC	Office Web Apps               	WAC Hosting Interaction       	adhsh	Monitorable	WOPI: Invalid file metadata [url:http://10.1.139.234/api/wopi/files/test.docx, triggers:(No Hash No Version No FileName No OwnerId), data:"{\"BaseFileName\":\"test.docx\",\"OwnerId\":\"admin\",\"SHA256\":\"oYokqCFw8WdWi00+5mhnn4GL1g+QXRuCDF6NIL3eYUU=\",\"Size\":272244,\"Version\":\"1\"}"]	b8317122-6964-4208-97a0-e89b702e61ac
      
      It seems json deserialize error, but i swear that it's truely correct.  Help me please ... Thanks very much.
    • You may want to take a look at another WOPI host implementation here: 
      
      https://github.com/Microsoft/Office-Online-Test-Tools-and-Documentation/tree/master/samples
      
      
  • Hi Shawn, thank you for this example.
    2 Posts | Last post October 03, 2015
    • In my case I have a rest JAVA web application, and I want to make it my WOPI host.
      Is it integrable ? especially for Cobalt who is MS-FSSHTTP ?
      Sorry for my english 
    • Yes, possible.  As always Cobalt is very difficult to implement.  
  • Getting "Server error - facing technical difficulties"
    2 Posts | Last post October 03, 2015
    • Hello Shawn,
      Thank you for providing this working example of a very unique concept.
      
      I have following setup:
      1. I have Office online subscription ( I am not sure where to provide the sing in information in the WOPHost application)
      1. I have setup your application wopihost on a public IP/domain name as http ( not secure).
      3. I have setup the document management system as pure web site on a public IP/domain name as http ( not secure)
      
      After I browse to the frameview page, and get a link for an existing document in the document management system I get following error.
      
      -----------------------------------------------
      The service is unavailable
      Service Unavailable
      We are currently experiencing technical difficulties.
      Please try again later.
      -----------------------------------------------
      
      Please help.
      
      Amit
    • This hasn't been tested with O365 - only an On-Premises OWA deployment...
  • Sorry, Word Web App ran into a problem opening this document.....
    2 Posts | Last post October 03, 2015
    • ... To view this document please open it in Microsoft Word.
      
      Hi ! So here's my issue :/ I've used your template (Wich is **** great !) and I managed to use it for excels for now. In fact, the rest should work finely, but it's not :/.
      
      First, i'm gonna show you what i changed. In the Get method from the FilesController (on /api/wopi/files/{name}/contents then), i had to get the content of "http" files. (like http://myserv.com/res/test.docx). So i changed your FileStream reading method with a WebClient reading Method. 
      This `using (WebClient client = new WebClient())
                      {
                          client.Credentials = CredentialCache.DefaultNetworkCredentials;
                          tmp = client.DownloadData(name);
                      }
      
                      //this.DownloadString(name, out status);
                      responseMessage.Content = new ByteArrayContent(tmp);`
      replaces this : `var stream = new FileStream(file, FileMode.Open, FileAccess.Read);
            responseMessage.Content = new StreamContent(stream);`
      
      Works finely for excels ! but i got this issue with word & ppt. What's even more weird, is that when i call 'myserv/api/wopi/files/myFileUrl/contents' it downloads me the files (which is logical) and the ppt isn't valid, but the word IS ! I can open the downloaded word files in my microsoft word, which means that my "reading method" isn't failing (at least for word files). But i still cannot open is through my Word OWA :/ Any idea ? Does this happened to anyone ?
    • could be the stream buffer is at the end, you may need to set the stream pointer back to 0 to make it read from the beginning or flush it.
      
      Not sure.
  • How to make it work?
    3 Posts | Last post October 03, 2015
    • I've tried to run it and Open test document.docx to edit and it showed me:
      "The requested URL could not be retrieved
      
      
      While trying to retrieve the URL: http://owa1.wingtip.com/we/wordeditorframe.aspx? 
      
      The following error was encountered: 
      
      Unable to determine IP address from host name for owa1.wingtip.com 
      
      The dnsserver returned: 
      
      Name Error: The domain name does not exist. 
      
      This means that: 
       The cache was not able to resolve the hostname presented in the URL. 
       Check if the address is correct. 
      "
      What Should I do?
      
    • Вам нужно опубликовать хост приложение у себя на веб сервере и указать его адрес конфиг файле. ресурс http://owa1.wingtip.com более недоступен и скорее всего он указан чисто для примера.
    • You probably for development, need to put host entries in your /etc/hosts file, which is in c:\windows\system32\drivers\etc
      
      
  • ows and rms
    2 Posts | Last post October 03, 2015
    • Hello Shawn. 
      thanks for your wopi application. can OWS work with rms protected documents ? i can not adapt your code working with rms documents, can you help me?
    • At this time, no RMS is not supported afaik.
1 - 10 of 37 Items