21
Office 365 DevDays 2017.11.4-6 | 上海 Office 365 DevDays 2017.11.4-6 | 上海 MS-WOPI: Web Application Open Platform Interface Jinghui Zhang Software Engineer @Microsoft

MS-WOPI: Web Application Open Platform Interface · •WOPI defines the way that on-premises hosts (e.g. SharePoint) interact with Office Online Server •This session is scoped to

  • Upload
    others

  • View
    10

  • Download
    0

Embed Size (px)

Citation preview

Page 1: MS-WOPI: Web Application Open Platform Interface · •WOPI defines the way that on-premises hosts (e.g. SharePoint) interact with Office Online Server •This session is scoped to

Office 365 DevDays

2017.11.4-6 | 上海

Office 365 DevDays

2017.11.4-6 | 上海

MS-WOPI: Web Application Open Platform Interface

Jinghui Zhang

Software Engineer @Microsoft

Page 2: MS-WOPI: Web Application Open Platform Interface · •WOPI defines the way that on-premises hosts (e.g. SharePoint) interact with Office Online Server •This session is scoped to

Overview

WOPI Flow

WOPI Discovery

REST Protocol

目 录CONTENTS

Page 3: MS-WOPI: Web Application Open Platform Interface · •WOPI defines the way that on-premises hosts (e.g. SharePoint) interact with Office Online Server •This session is scoped to

Overview

• WOPI defines the way that on-premises hosts (e.g. SharePoint)

interact with Office Online Server

• This session is scoped to on-premise scenarios only, which are

documented at MS-WOPI

• The goal is to provide an overview of the MS-WOPI protocol

and demonstrate how it functions

Page 4: MS-WOPI: Web Application Open Platform Interface · •WOPI defines the way that on-premises hosts (e.g. SharePoint) interact with Office Online Server •This session is scoped to

The WOPI Flow

WOPI Source

Host Frame

App Frame

▪ WOPI Source

▪ Access Token

Page 5: MS-WOPI: Web Application Open Platform Interface · •WOPI defines the way that on-premises hosts (e.g. SharePoint) interact with Office Online Server •This session is scoped to

Example Flow: Viewing a File

https://msdn.microsoft.com/en-us/library/hh641756.aspx

Page 6: MS-WOPI: Web Application Open Platform Interface · •WOPI defines the way that on-premises hosts (e.g. SharePoint) interact with Office Online Server •This session is scoped to

WOPI Discovery

…/hosting/discovery

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

<app name="Word" … ><action name="view"

ext="docx"default="true"urlsrc="..."/>

</app></net-zone>

</wopi-discovery>

Host records bindings

between file extensions

and URLs

Page 7: MS-WOPI: Web Application Open Platform Interface · •WOPI defines the way that on-premises hosts (e.g. SharePoint) interact with Office Online Server •This session is scoped to

Discovery XML

<wopi-discovery>

<net-zone name="external-https">

<app name="Word"

favIconUrl="https://.../FavIcon_Word.ico"

checkLicense="true">

<action name="edit"

ext="docx"

requires="update"

urlsrc="https://.../frame.aspx?<ui=UI_LLCC&><rs=DC_LLCC&>"/>

</app>

</net-zone>

</wopi-discovery>

Page 8: MS-WOPI: Web Application Open Platform Interface · •WOPI defines the way that on-premises hosts (e.g. SharePoint) interact with Office Online Server •This session is scoped to

Conventions for <action />

▪ Not a traditional XML schema

▪ Ignore the entry if its name is unknown

▪ Ignore the entry if one of its required capabilities is unknown

▪ urlsrc handling is complicated

Page 9: MS-WOPI: Web Application Open Platform Interface · •WOPI defines the way that on-premises hosts (e.g. SharePoint) interact with Office Online Server •This session is scoped to

The REST Protocol

Page 10: MS-WOPI: Web Application Open Platform Interface · •WOPI defines the way that on-premises hosts (e.g. SharePoint) interact with Office Online Server •This session is scoped to

REST Resource URIs

Resource Description

http://server/<...>/wopi*/...

files/<id> Provides access to information about a file and allows for file-level operations.

folders/<id> Provides access to information about a folder and allows for folder level operations.

files/<id>/contents Provides access to operations that get and update the contents of a file.

folder/<id>/children Provides access to the files and folders in a folder.

Page 11: MS-WOPI: Web Application Open Platform Interface · •WOPI defines the way that on-premises hosts (e.g. SharePoint) interact with Office Online Server •This session is scoped to

The View Flow (again)

1. WOPI host generates Office Online URL based on discovery XML

2. WOPI host navigates a web page to Office Online URL

3. Office Online initiates GET to WOPISource URL• http://server/<...>/wopi*/files/<id>

4. Office Online initiates GET to file contents WOPI endpoint• http://server/<...>/wopi*/files/<id>/contents

5. Office Online renders file

Page 12: MS-WOPI: Web Application Open Platform Interface · •WOPI defines the way that on-premises hosts (e.g. SharePoint) interact with Office Online Server •This session is scoped to

Files

• http://server/<...>/wopi*/files/<id>

• Returns information about the file and permissions that the current user has relative to

that file

• Contains information that the WOPI app may use to modify the user experience

• These are minimal response requirements for a CheckFileInfo request…

{"BaseFileName": "Sample Document.docx", "OwnerId": "johndoe", "Size": 300519,"Version": "GIYDCMBQGAVTAMB2GAYA===="

}

Page 13: MS-WOPI: Web Application Open Platform Interface · •WOPI defines the way that on-premises hosts (e.g. SharePoint) interact with Office Online Server •This session is scoped to

File Contents

• http://server/<...>/wopi*/files/<id>/contents

• GetFile

• PutFile

Page 14: MS-WOPI: Web Application Open Platform Interface · •WOPI defines the way that on-premises hosts (e.g. SharePoint) interact with Office Online Server •This session is scoped to

Files

http://server/<...>/wopi*/files/<id>

Some sample parameters…• CloseUrl

• DownloadUrl

• DisablePrint

• ReadOnly

• SupportsExtendedLockLength

Page 15: MS-WOPI: Web Application Open Platform Interface · •WOPI defines the way that on-premises hosts (e.g. SharePoint) interact with Office Online Server •This session is scoped to

Post Files With X-WOPI-Override

• PutRelativeFile

• Lock

• Unlock

• RefreshLock

• UnlockAndRelock

• ExecuteCellStorageRequest

• ExecuteCellStorageRelativeRequest

• DeleteFile

• ReadSecureStore

• GetRestrictedLink

• RevokeRestrictedLink

POST http://server/<...>/wopi*/files/<id>

Page 16: MS-WOPI: Web Application Open Platform Interface · •WOPI defines the way that on-premises hosts (e.g. SharePoint) interact with Office Online Server •This session is scoped to

Client-side Integration: PostMessage

• Allows hosts to plug into pieces of our UI

• Historically messages have been added ‘as needed’ with little review or consideration

• PostMessage is now a part of our public API, since it is necessary for many basic scenarios

Page 17: MS-WOPI: Web Application Open Platform Interface · •WOPI defines the way that on-premises hosts (e.g. SharePoint) interact with Office Online Server •This session is scoped to

Host Frame

App Frame

Client-side Integration: PostMessage

Page 18: MS-WOPI: Web Application Open Platform Interface · •WOPI defines the way that on-premises hosts (e.g. SharePoint) interact with Office Online Server •This session is scoped to

Example Flow: Share

• Host tells us they want to handle the ‘Share’ message in CheckFileInfo

FileSharingPostMessage = true

• When the Share button is clicked, we send the host the UI_Sharing

message

• The host sends us the Blur_Focus message so we stop aggressively

grabbing focus

• The host displays their Share UI

• When the user is done sharing, the host sends us the Grab_Focus message

Page 19: MS-WOPI: Web Application Open Platform Interface · •WOPI defines the way that on-premises hosts (e.g. SharePoint) interact with Office Online Server •This session is scoped to

Example Messages

Message hosts can send

• Blur_Focus

• Grab_Focus

• Host_PerfTiming

• Host_PostmessageReady

Messages hosts can receive

• File_Rename

• UI_Close

• UI_Edit

• UI_FileVersions

• UI_Sharing

Page 20: MS-WOPI: Web Application Open Platform Interface · •WOPI defines the way that on-premises hosts (e.g. SharePoint) interact with Office Online Server •This session is scoped to

Verifying Requests Are From Us: Proof Keys

• We sign every WOPI request with our private key

• We publish our public key in discovery

• Hosts can use the public key to validate that requests come from us

Page 21: MS-WOPI: Web Application Open Platform Interface · •WOPI defines the way that on-premises hosts (e.g. SharePoint) interact with Office Online Server •This session is scoped to

Office 365 DevDays

Thank you