< 上一个 | 内容 | 下一个 >

C.7 Subscription/Notification


Description: C:\Users\EA068\Desktop\ExampleSection\docs-12-0264-04-Subscription_Example\Subscription_General.gif

Figure C.6—Subscription/Notification


NOTE—An XML example in POX encoding is provided along with the EXI equivalent.


Table C.7—POX example: Subscription/Notification


Step

Description

1

After discovering the URI of the server’s SubscriptionList and desired resource, the client can append new subscription entries to the list.


Note: In this case, the client is conditionally subscribing to an instantaneous meter reading value. If the value is less than 10 or greater than 1000, a Notification is sent to the specified notificationURI in the POX encoded format.


POST /edev/8/sub HTTP/1.1 Host: {hostname}

Content-Type: application/sep+xml Content-Length: {contentLength}

<Subscription xmlns="urn:ieee:std:2030.5:ns">

<subscribedResource>/upt/0/mr/4/r</subscribedResource>

<encoding>0</encoding>

<level>+S1</level>

<limit>1</limit>

<notificationURI>/note</notificationURI>

</Subscription>

2

If new subscription entries are created, the server would respond with the following, where Location indicates the path to the newly created subscription resource:


HTTP/1.1 201 Created Location: /edev/8/sub/5

If entries were not created but modified the server would respond with:


HTTP/1.1 204 No Content

3

A change on the subscribed resource occurs which satisfies the above specified conditions.

4

Notification is sent from the server to the client:


POST /note HTTP/1.1 Host: {hostname}

Content-Type: application/sep+xml Content-Length: {contentLength}

<Notification xmlns="urn:ieee:std:2030.5:ns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<subscribedResource>/upt/0/mr/4/r</subscribedResource>

<Resource xsi:type="Reading">

<timePeriod>

<duration>0</duration>

<start>12987364</start>

</timePeriod>

<value>1001</value>

</Resource>

<status>0</status>

<subscriptionURI>/edev/8/sub/5</subscriptionURI>

</Notification>

5

The client responds with HTTP response:


HTTP/1.1 201 Created


Table C.8—EXI example: Subscription/Notification


Step

Description

1

(Same as POX example with the following exceptions) POST format is set with:

Content-Type: application/sep-exi

Notification encoding type is specified with:

<encoding>1</encoding>

Notification schema version and options are specified with:

<level>-S1</level>

POST /edev/8/sub HTTP/1.1 Host: {hostname}

Content-Type: application/sep-exi Content-Length: {contentLength}

a030 114c c716 41e5 eeae 0e85 e605 edae 45e6 85ee 4400 014a d4cc 4008 072f 6e6f 7465 00

(35 bytes in binary, shown in hexadecimal)

2

(Same as POX example)

3

(Same as POX example)

4

(Same as POX example with the following exceptions) POST format is set with:

Content-Type: application/sep-exi

POST /note HTTP/1.1 Host: {hostname}

Content-Type: application/sep-exi Content-Length: {contentLength}

a030 114c c6bc 41e5 eeae 0e85 e605 edae 45e6 85ee 4614 010a 4000 3935 e601 8274

8390 0007 97b2 b232 bb17 9c17 b9ba b117

9a80

(50 bytes in binary, shown in hexadecimal)

5

(Same as POX example)