The previous article has introduced the entire installation process. As soon as you enter the IP of the document conversion server in the browser, it automatically jumps to the following page.
Then you can implement the local document preview, you can try it. (Note: It is local, the path is not wrong, like "\\file\share"). If you cannot preview, then also pay attention to the permissions of the document Oh, not much to say. )
Seeing this, even if you have completed more than 80% of the work, then now only need to integrate into their own projects.
The following is also the main reference: http://www.cnblogs.com/poissonnotes/p/3277280.html
This article is also Super Classic. (The previous installment is also referring to this author, the article is very classic)
I'm not ashamed to use PHP to fry the leftovers again.
1, the main implementation of the Wopi Protocol (http://msdn.microsoft.com/en-us/library/hh622722 (v=office.12). aspx see Wopi protocol, install 13, you can download it to see)
Wopi communication mainly implements two services:
1), one is Checkfileinfo service
2), one is GetFile service
2. Create a service
1), first create Checkfileinfo service
Let's first determine the routing address for this service.
Set to: http://server/<...>/wopi*/files/?access_token=
Note: There is no validation access_token, please verify it yourself. Many classmates ask Access_token how to come, this oneself set on line, not must.
The code is implemented as follows, primarily to return file information for a JSON object.
Enter in the browser: Http://localhost/wopihost/wopi/files/test.docx (the Test.docx file needs to exist in the project), return the following data, indicating success
2), then to make GetFile services
Let's first determine the routing address for this service.
Set to: http://server/<...>/wopi*/files//contents?access_token=
The code is as follows: The GetFile service is primarily a data stream that returns files.
3), Verification services
Http://192.168.1.21/hosting/discovery
The information returned by the links above allows you to know the links to different types of document access.
Enter the following link in the browser: http://192.168.1.21/wv/wordviewerframe.aspx? Wopisrc=http%3a%2f%2f192.168.1.102%2fwopihost%2fwopi%2ffiles%2ftest.docx
(Note that the test document must be present, the path is correct.)
Where: 192.168.1.21 is Office Web Apps server,192.168.1.102 is a server that implements Wopi services
If the following appears, it indicates success.
Note: If you are not successful, do not lose heart, you can debug Excel first, because Excel does not validate the SHA256 algorithm, if Excel succeeds, other types of documents are not successful, then the SHA256 algorithm implementation is not correct.
Attached to my wopihost open source implementation, for reference only: Https://github.com/cisiqo/WopiHost (recent cramps, slow access)
Also attached is the conversion page of the company's use of the scheme: the first one using an IFRAME, the second normally accessed
Microsoft Office Web Apps Server build online document Preview (b)