Example 2: Retrieve the public URL of a remote content

In this case, the server handles files (like an ECM platform). A client needs the unique URL of a remote content. The CID process allows a user to select a content and defines how the client can retrieve its Public-url.

Server manifest

1
<?xml version="1.0" encoding="UTF-8"?>
2
<cid:manifest xmlns:cid="http://www.cid-protocol/schema/v1/core" xmlns:xml="http://www.w3.org/XML/1998/namespace"
3
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
              xsi:schemaLocation="http://www.cid-protocol/schema/v1/core ../manifest/cid-core.xsd ">
5
    <cid:process is="http://schema.org/FindAction http://schema.org/CheckAction">
6
        <cid:label xml:lang="en">Public URL retrieving</cid:label>
7
        <cid:doc xml:lang="en">Browse your online contents to retrieve a public URL.</cid:doc>
8
        <cid:meta name="Public-url" is="http://schema.org/url"/>
9
        <!-- The process is composed by a single interaction step. -->
10
        <cid:interact url="http://.." returnMetas="Public-url" required="true"/>
11
    </cid:process>
12
    <!-- 
13
    The web interaction begins with a single HTTP request and ends with a message event 	
14
    (http://www.w3.org/TR/webmessaging) containing a cidInteraction property stored in the data
15
    part of the event. This property must be set to "ended" (in case of regular end of the step)
16
    or "aborted" (in case of step cancelled by the user). The client must instantiate a web frame
17
    and fill it with the result of the first request. It gets the returned metadata in the data
18
    part of the message event. In this example, the server does not furnish any authentication scheme.
19
    It could handle a web authentication in the frame or let a public access to the platform. 
20
    -->
21
    <cid:transports>
22
        <cid:webTransport>
23
            <cid:authentications/>
24
            <cid:webInteract>
25
                <cid:request method="GET" properties="header queryString"/>
26
                <cid:request method="POST;application/x-www-form-urlencoded" properties="queryString header post"/>
27
                <cid:request method="POST;multipart/form-data" properties="header queryString post"/>
28
            </cid:webInteract>
29
        </cid:webTransport>
30
    </cid:transports>
31
</cid:manifest>

The process step by step

Procedure

  1. Manifest exposition

    The server must expose the XML manifest to an accessible URL. For example, at http://example.com/manifest.xml.

  2. Download the manifest

    In order to understand the process, a client must download the server manifest and analyze it.

    Download the manifest
  3. Direct interaction

    The client can now execute the defined step. In this case, the client must send a single HTTP request and show the result in a web frame. The user should then interact directly with the server using the frame.

    Direct interaction

    At the end of the process, the web page of the frame must post a message event throught the message API. The client must catch this event and read the endInteraction property store in the data part of the event. This property must be set to ended when the interaction is regularly closed or aborted when the user cancelled the process during the interaction. In case of regularly ended interaction, the returned metadata documented in this step are also stored: the Public-url in this case.