SlideShare a Scribd company logo
1 of 34
XCAP
The Extensible Markup Language (XML)
Configuration Access Protocol (XCAP)
邱振剛
What is XCAP?
2
 XCAP能夠讓使用者讀取、新增、修改儲存在
Server上的好友資料(XML格式)
 XCAP能將XML文件內的元素、屬性等,映射
到HTTP URI
 XCAP在Presence System中的應用
 Buddy Lists
 Authorization Policies
 Hard state presence data
Buddy List Use Case
 Client wants to subscribe
to a list of users
 Send SUBSCRIBE to
server using SIP event
list extension
 Server retrieves list
associated with buddylist
URI
 Generates SUBSCRIBEs to
them
 Client can manage that
list
 Add, remove, modify entries
Subscribe Joe
Subscribe Bob
Subscribe Mary
Subscribe List
Read
List
Write
List
Data
Manipulation
Server
Client
Standard Ifaces
Hiroshi
Hiroshi
Authorization Use Case
 User Hiroshi subscribes to
Petri
 No auth policy in place,
generates a winfo
NOTIFY to Petri
 Petri needs to be able to
set authorization decision
for Hiroshi
 Want to be able to set
such policies outside of a
subscription as well
Subscribe Petri
Read
List
Write
List
Data
Manipulation
Server
Client
Standard Ifaces
winfo
Hiroshi
Petri
Hard State Presence Management
 Hiroshi subscribes to Petri
 Petri has been offline for
weeks
 Server sends NOTIFY
with current presence
state
 Petri wants to control
default state when offline
 Set it to
<activity>vacation</activit
y>
Subscribe Petri
Read
PIDF
Write
PIDF
Data
Manipulation
Server
Client
Standard Ifaces
Notify
Hiroshi
Petri
XML-Extensible Markup Language(1/2)
6
 能夠建立特殊標記的通用標記語言。
 <name>、<phone>、<姓名>、<電話>
 XML 是屬於純本文的資料,因此適合做資訊交換使用。
 XML著重在如何將文件資料以結構化的方式來表示,
HTML著重在如何將文件顯示在瀏覽器中。
 XML有簡明的語法和明確的結構,無論是對人或程式,讀
取和解析都很簡單。
<?xml version="1.0"
encoding="UTF-8"?>
<resource-lists>
<list name="friends">
<entry
uri="sip:bob@example.com">
<name>Bob Jones</name>
</entry>
</list>
<other/>
</resource-lists>
</xml>
<?xml version="1.0"
encoding="UTF-8"?>
<resource-lists>
<list name="friends">
<entry
uri="sip:bob@example.com">
<name>Bob Jones</name>
</entry>
</list>
<other/>
</resource-lists>
</xml>
XML-Extensible Markup Language(2/2)
7
 XML Document: 如左為XML文
檔,被設計用來傳輸和儲存資料。
 XML element: <list>…</list>,
元素也可空元素<other/>
 XML Attributes: 可以將元素加入
標籤,提供額外的訊息內容。
XML Document: 如左為XML文
檔。
XML element: <list>…</list>,
元素也可空元素<other/>。
XML Attributes: 可以將元素加
入標籤,提供額外的訊息內容
<?xml version="1.0"
encoding="UTF-8"?>
<resource-lists>
<list name="friends">
<entry
uri="sip:bob@example.com">
<name>Bob Jones</name>
</entry>
</list>
<other/>
</resource-lists>
</xml>
<?xml version="1.0"
encoding="UTF-8"?>
<resource-lists">
<list name="friends">
<entry
uri="sip:bob@example.com">
<name>Bob Jones</name>
</entry>
</list>
<other/>
</resource-lists>
</xml>
XPath
8
 XPath = XML Addressing
 XPath 是在 XML 檔案中查找訊息的語言。
 XPath 可用在 XML 檔案中對元素和屬性進行瀏覽。
 Positional Selectors
resource-
lists/list/entry/name
<?xml version="1.0" encoding="UTF-8"?>
<resource-lists">
<list name="friends">
<entry uri="sip:bob@example.com">
<name>Bob Jones</name>
</entry>
</list>
</resource-lists>
resource-lists/list/entry/@uri
XML Namespaces (1/2)
9
 減少定義不明的元素,讓元素
具有唯一性。
 如左圖XML文件中有兩個
<state>標籤,而程式指定
<state>時該如何區分?
<?xml version="1.0" encoding="UTF-8"?>
<address-book>
<!—This guy is a bozo --
<entry>
<name>Jonathan Rosenberg</name>
<email>jdrosen@dynamicsoft.com</email>
<postal>
<street paved=“true”>600 Lanidex Pl</street>
<city>Parsippany</city>
<state>NJ</state>
<country>USA</country>
</postal>
<state>synchronized</state>
<ietf-participant/>
</entry>
</address-book>
XML Namespaces (2/2)
10
 解決方式:
 使用XML Namespaces
 Namespaces利用單一
的URI定義
 定義好的名稱,在所屬
元素前,利用冒號與元
素名相接。
 XML解析器不會對定義
的URI有任何動作,XML
解析器只判斷是否為唯
一值。
<?xml version="1.0" encoding="UTF-8"?
xmlns:post=“http://www.post.com”
xmlns:sync=“http://www.sync.com”>
<post:address-book>
<!—This guy is a bozo --
<post:entry>
<post:name>Jonathan Rosenberg</post:name>
<post:email>jdrosen@dynamicsoft.com</post:email>
<post:postal>
<post:street paved=“true”>600 Lanidex
Pl</post:street>
<post:city>Parsippany</post:city>
<post:state>NJ</post:state>
<post:country>USA</post:country>
</post:postal>
<post:ietf-participant/>
<sync:state>synchronized</sync:state>
</post:entry>
</post:address-book>
XML Schema
11
 描述與限定XML文件的結構:
 包含哪些元素(elements)、屬性(attributes)
 元素的順序與重複性
 限定每個元素與屬性的資料型態與值域
 xs:string
 xs:decimal
 xs:integer
 xs:boolean
 xs:date
 xs:time
0~99的整數
xs:minInclusive
xs:maxInclusive
<xs:element name="age">
<xs:simpleType>
<xs:restriction
base="xs:integer">
<xs:minInclusive value="0"/>
<xs:maxInclusive
value="100"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
12
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://www.post.com" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.post.com" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="address-book">
<xs:complexType>
<xs:sequence>
<xs:element name="entry" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="email" type="xs:string"/>
<xs:element name="postal">
<xs:complexType>
<xs:sequence>
<xs:element name="street" type="xs:string"/>
<xs:element name="city" type="xs:string"/>
<xs:element name="state">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="NJ"/>
<xs:enumeration value="NY"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="country" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="ietf-participant"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
XML Schema
<?xml version="1.0" encoding="UTF-8"?>
<address-book>
<!—This guy is a bozo --
<entry>
<name>Jonathan Rosenberg</name>
<email>jdrosen@dynamicsoft.com</email>
<postal>
<street paved=“true”>600 Lanidex Pl</street>
<city>Parsippany</city>
<state>NJ</state>
<country>USA</country>
</postal>
<ietf-participant/>
</entry>
</address-book>
Application Usage(1/5)
13
 Each application has its own Application
Usage
 Define how the XCAP server can
manipulate corresponding application
documents
 Key components:
 AUID
 XML Schema
 Data Semantics
 Resource Interdependency
 Authorization Policies
14
 Application Unique ID
 Unique Identifier for each application
 Two sub-namespaces
 IETF tree
 Example : “resource-lists” , “pidf-
manipulation” , “pres-rules”
 Vendor tree:
 prefixed with the reverse domain name of the
organization
 Example: “com.example.customer-list”
Application Usage(2/5)
15
 Data Semantics
 An address book is a series of <entry> elements
 Each <entry> is information about an entry in the
address book
 It has a <name>, which is the use persons first and
last name
 It has an <email> element, which contains the email
address of the person
 It has a <postal> element that has the postal address
Application Usage(3/5)
16
 Resource interdependency
 Operation of one element may affect other elements;
especially cross-document affection
Application Usage(4/5)
 Think of the application usage
as a client of XCAP
 Handset puts a new resource
list (1)
 Application learns of change (4)
 Acting as a client, application
modifies data(5)
17
 Authorization policies
 User can read & write their own data
 User can only read global data
 Global data is readable by everyone, writeable by no one except
privileged users
Application Usage(5/5)
URI Construction
18
Based on the Concept of XPath
Example: XCAP root / Document Selector / Node Selector
 XCAP root
Context in which all other resources exist
"http://xcap.example.com" for domain "example.com "
 Document Selector
"/resource-lists/users/sip:joe@example.com/index"
 Node Selector
~~/resource-lists/list%5b@name=%22l1%22%5d
XCAP URI的樹狀結構
<?xml version="1.0" encoding="UTF-8"?>
<resource-lists xmlns="urn:ietf:params:xml:ns:resource-lists">
<list name="friends">
<entry uri="sip:bob@example.com">
<name>Bob Jones</name>
</entry>
<list name="close-friends">
<entry uri="sip:hiroshi@example.com">
<name>Hiroshi Aukia</name>
</entry>
</list>
</list>
</resource-lists>
GET
http://xcap.example.com/
resource-lists/users/hiroshi/buddlist/
~~/resource-lists/list/list/entry/name
Operations
20
 HTTP PUT
Create or Replace a Document/Element/Attribute
 HTTP DELETE
Delete a Document/Element/Attribute
 HTTP GET
Fetch a Document/Element/Attribute
Fetching a Document
GET http://xcap.example.com/address-book/users/petri/adbook1 HTTP/1.1
HTTP/1.1 200 OK
Content-Type: application/adbook+xml
Content-Length: …
<?xml version="1.0" encoding="UTF-8"?>
<address-book>
<!—This guy is a bozo --
<entry>
<name>Jonathan Rosenberg</name>
<email>jdrosen@dynamicsoft.com</email>
<postal>
<street paved=“true”>600 Lanidex Pl</street>
<city>Parsippany</city>
<state>NJ</state>
<country>USA</country>
</postal>
<ietf-participant/>
</entry>
</address-book>
<?xml version="1.0" encoding="UTF-8"?>
<address-book>
<!—This guy is a bozo --
<entry>
<name>Jonathan Rosenberg</name>
<email>jdrosen@dynamicsoft.com</email>
<postal>
<street paved=“true”>600 Lanidex Pl</street>
<city>Parsippany</city>
<state>NJ</state>
<country>USA</country>
</postal>
<ietf-participant/>
</entry>
</address-book>
adbook1
Fetching an Element
GET http://xcap.example.com/address-book/users/petri/adbook1/
address-book/entry/name HTTP/1.1
HTTP/1.1 200 OK
Content-Type: application/xml-fragment-body
Content-Length: …
<name>Jonathan Rosenberg</name>
<?xml version="1.0" encoding="UTF-8"?>
<address-book>
<!—This guy is a bozo --
<entry>
<name>Jonathan Rosenberg</name>
<email>jdrosen@dynamicsoft.com</email>
<postal>
<street paved=“true”>600 Lanidex Pl</street>
<city>Parsippany</city>
<state>NJ</state>
<country>USA</country>
</postal>
<ietf-participant/>
</entry>
</address-book>
adbook1
Fetching an Attribute
GET http://xcap.example.com/address-book/users/petri/adbook1/
address-book/entry/street/@paved HTTP/1.1
HTTP/1.1 200 OK
Content-Type: application/xml-attribute-value
Content-Length: …
true
<?xml version="1.0" encoding="UTF-8"?>
<address-book>
<!—This guy is a bozo --
<entry>
<name>Jonathan Rosenberg</name>
<email>jdrosen@dynamicsoft.com</email>
<postal>
<street paved=“true”>600 Lanidex Pl</street>
<city>Parsippany</city>
<state>NJ</state>
<country>USA</country>
</postal>
<ietf-participant/>
</entry>
</address-book>
adbook1
Delete a Document
DELETE http://xcap.example.com/address-book/users/petri/adbook1 HTTP/1.1
HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<address-book>
<!—This guy is a bozo --
<entry>
<name>Jonathan Rosenberg</name>
<email>jdrosen@dynamicsoft.com</email>
<postal>
<street paved=“true”>600 Lanidex Pl</street>
<city>Parsippany</city>
<state>NJ</state>
<country>USA</country>
</postal>
<ietf-participant/>
</entry>
</address-book>
adbook1
NULL
Deleting an Element
DELETE http://xcap.example.com/address-
book/users/petri/adbook1/
address-book/entry/name/email HTTP/1.1
HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<address-book>
<!—This guy is a bozo --
<entry>
<name>Jonathan Rosenberg</name>
<email>jdrosen@dynamicsoft.com</email>
<postal>
<street paved=“true”>600 Lanidex Pl</street>
<city>Parsippany</city>
<state>NJ</state>
<country>USA</country>
</postal>
<ietf-participant/>
</entry>
</address-book>
adbook1
<?xml version="1.0" encoding="UTF-8"?>
<address-book>
<!—This guy is a bozo --
<entry>
<name>Jonathan Rosenberg</name>
<postal>
<street paved=“true”>600 Lanidex Pl</street>
<city>Parsippany</city>
<state>NJ</state>
<country>USA</country>
</postal>
<ietf-participant/>
</entry>
</address-book>
Deleting an Attribute
DELETE http://xcap.example.com/address-
book/users/petri/adbook1/
address-
book/entry/name/postal/street/@paved
HTTP/1.1
HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<address-book>
<!—This guy is a bozo --
<entry>
<name>Jonathan Rosenberg</name>
<email>jdrosen@dynamicsoft.com</email>
<postal>
<street paved=“true”>600 Lanidex Pl</street>
<city>Parsippany</city>
<state>NJ</state>
<country>USA</country>
</postal>
<ietf-participant/>
</entry>
</address-book>
adbook1
<?xml version="1.0" encoding="UTF-8"?>
<address-book>
<!—This guy is a bozo --
<entry>
<name>Jonathan Rosenberg</name>
<postal>
<street>600 Lanidex Pl</street>
<city>Parsippany</city>
<state>NJ</state>
<country>USA</country>
</postal>
<ietf-participant/>
</entry>
</address-book>
新增、修改
27
 兩個操作都是使用PUT Request操作文件的內容。
 Server 根據 URI 檢查的方式如下
 解析URI並檢查,文件是否存在、元素是否存在、屬性是
否存在
 不存在就新增 : 新增到同階層的位置
 存在就修改 : 根據URI修改替換舊資料
Add an Element
PUT http://xcap.example.com/address-
book/users/petri/adbook1/
address-book/entry/phone HTTP/1.1
Content-Type: application/xml-fragment-body
<phone>+19739525000</phone>
HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<address-book>
<!—This guy is a bozo --
<entry>
<name>Jonathan Rosenberg</name>
<email>jdrosen@dynamicsoft.com</email>
<postal>
<street paved=“true”>600 Lanidex Pl</street>
<city>Parsippany</city>
<state>NJ</state>
<country>USA</country>
</postal>
<ietf-participant/>
</entry>
</address-book>
adbook1
<?xml version="1.0" encoding="UTF-8"?>
<address-book>
<!—This guy is a bozo --
<entry>
<name>Jonathan Rosenberg</name>
<phone>+19739525000</phone>
<email>jdrosen@dynamicsoft.com</email>
<postal>
<street paved=“true”>600 Lanidex Pl</street>
<city>Parsippany</city>
<state>NJ</state>
<country>USA</country>
</postal>
<ietf-participant/>
</entry>
</address-book>
Modify an Element
PUT http://xcap.example.com/address-
book/users/petri/adbook1/
address-book/entry/name HTTP/1.1
Content-Type: application/xml-fragment-body
<name>Jonathan D. Rosenberg</name>
HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<address-book>
<!—This guy is a bozo --
<entry>
<name>Jonathan Rosenberg</name>
<email>jdrosen@dynamicsoft.com</email>
<postal>
<street paved=“true”>600 Lanidex Pl</street>
<city>Parsippany</city>
<state>NJ</state>
<country>USA</country>
</postal>
<ietf-participant/>
</entry>
</address-book>
adbook1
<?xml version="1.0" encoding="UTF-8"?>
<address-book>
<!—This guy is a bozo --
<entry>
<name>Jonathan D. Rosenberg</name>
<email>jdrosen@dynamicsoft.com</email>
<postal>
<street paved=“true”>600 Lanidex Pl</street>
<city>Parsippany</city>
<state>NJ</state>
<country>USA</country>
</postal>
<ietf-participant/>
</entry>
</address-book>
Conditional Operation
30
 若多方對同一個XML檔進行編輯時,就會發生的衝
突。
 ETag : 可以讓client端與server端的資源關聯記號
(token)。
 配合HTTP定義的header
 if-Match : 若符合,則進行程序
 if-Non-Match : 若不符合,則進行程序
 衝突發生時,Server回傳 412 condition fails
流程範例
31
 User A has version ABC
 Adds buddy, adds If-
Match: ABC
 Buddy added, new
version DEF
 User B also has version
ABC
 Tries to modify it, but it
fails
 B can now fetch it and
make its diff against the
current version
Security Considerations
32
 Data manipulated by XCAP often contains
sensitive information
 Using HTTP port: 80
– Hard to apply port-based filtering
Solutions
33
 Connection over TLS(Transport Layer Security)
 HTTP Digest Authentication
 Authorization policies in Application Usage
Conclusion
34
 Access configuration documents on server:
Presence system
 Maps XML documents and document components
into HTTP URIs
 HTTP primitives can be used to directly manipulate
the data

More Related Content

What's hot

Easy rest service using PHP reflection api
Easy rest service using PHP reflection apiEasy rest service using PHP reflection api
Easy rest service using PHP reflection apiMatthieu Aubry
 
Solr Application Development Tutorial
Solr Application Development TutorialSolr Application Development Tutorial
Solr Application Development TutorialErik Hatcher
 
Web services in PHP using the NuSOAP library
Web services in PHP using the NuSOAP libraryWeb services in PHP using the NuSOAP library
Web services in PHP using the NuSOAP libraryFulvio Corno
 
RESTful JSON web databases
RESTful JSON web databasesRESTful JSON web databases
RESTful JSON web databaseskriszyp
 
Linked data: spreading data over the web
Linked data: spreading data over the webLinked data: spreading data over the web
Linked data: spreading data over the webshellac
 
Tabular Data on the Web
Tabular Data on the WebTabular Data on the Web
Tabular Data on the WebGregg Kellogg
 
Making Java REST with JAX-RS 2.0
Making Java REST with JAX-RS 2.0Making Java REST with JAX-RS 2.0
Making Java REST with JAX-RS 2.0Dmytro Chyzhykov
 
Progress Report
Progress ReportProgress Report
Progress Reportxoanon
 
Introduction to JSON & Ajax
Introduction to JSON & AjaxIntroduction to JSON & Ajax
Introduction to JSON & AjaxSeble Nigussie
 
JSR 339 - Java API for RESTful Web Services
JSR 339 - Java API for RESTful Web ServicesJSR 339 - Java API for RESTful Web Services
JSR 339 - Java API for RESTful Web ServicesRicardo Longa
 
Data structures for cloud tag storage
Data structures for cloud tag storageData structures for cloud tag storage
Data structures for cloud tag storageAlexander Tokarev
 
Beyond full-text searches with Lucene and Solr
Beyond full-text searches with Lucene and SolrBeyond full-text searches with Lucene and Solr
Beyond full-text searches with Lucene and SolrBertrand Delacretaz
 

What's hot (18)

Easy rest service using PHP reflection api
Easy rest service using PHP reflection apiEasy rest service using PHP reflection api
Easy rest service using PHP reflection api
 
Solr Application Development Tutorial
Solr Application Development TutorialSolr Application Development Tutorial
Solr Application Development Tutorial
 
IR with lucene
IR with luceneIR with lucene
IR with lucene
 
Thinking restfully
Thinking restfullyThinking restfully
Thinking restfully
 
Web services in PHP using the NuSOAP library
Web services in PHP using the NuSOAP libraryWeb services in PHP using the NuSOAP library
Web services in PHP using the NuSOAP library
 
RESTful JSON web databases
RESTful JSON web databasesRESTful JSON web databases
RESTful JSON web databases
 
4 sw architectures and sparql
4 sw architectures and sparql4 sw architectures and sparql
4 sw architectures and sparql
 
Linked data: spreading data over the web
Linked data: spreading data over the webLinked data: spreading data over the web
Linked data: spreading data over the web
 
Tabular Data on the Web
Tabular Data on the WebTabular Data on the Web
Tabular Data on the Web
 
RDFa Tutorial
RDFa TutorialRDFa Tutorial
RDFa Tutorial
 
Solr Architecture
Solr ArchitectureSolr Architecture
Solr Architecture
 
Making Java REST with JAX-RS 2.0
Making Java REST with JAX-RS 2.0Making Java REST with JAX-RS 2.0
Making Java REST with JAX-RS 2.0
 
Progress Report
Progress ReportProgress Report
Progress Report
 
Introduction to JSON & Ajax
Introduction to JSON & AjaxIntroduction to JSON & Ajax
Introduction to JSON & Ajax
 
JSR 339 - Java API for RESTful Web Services
JSR 339 - Java API for RESTful Web ServicesJSR 339 - Java API for RESTful Web Services
JSR 339 - Java API for RESTful Web Services
 
Data structures for cloud tag storage
Data structures for cloud tag storageData structures for cloud tag storage
Data structures for cloud tag storage
 
FOAF
FOAFFOAF
FOAF
 
Beyond full-text searches with Lucene and Solr
Beyond full-text searches with Lucene and SolrBeyond full-text searches with Lucene and Solr
Beyond full-text searches with Lucene and Solr
 

Similar to xcap

Phalcon 2 High Performance APIs - DevWeekPOA 2015
Phalcon 2 High Performance APIs - DevWeekPOA 2015Phalcon 2 High Performance APIs - DevWeekPOA 2015
Phalcon 2 High Performance APIs - DevWeekPOA 2015Jackson F. de A. Mafra
 
A Conversation About REST
A Conversation About RESTA Conversation About REST
A Conversation About RESTJeremy Brown
 
A Conversation About REST
A Conversation About RESTA Conversation About REST
A Conversation About RESTMike Wilcox
 
Restful webservices
Restful webservicesRestful webservices
Restful webservicesKong King
 
Java Script Based Client Server Webapps 2
Java Script Based Client Server Webapps 2Java Script Based Client Server Webapps 2
Java Script Based Client Server Webapps 2kriszyp
 
A Conversation About REST - Extended Version
A Conversation About REST - Extended VersionA Conversation About REST - Extended Version
A Conversation About REST - Extended VersionJeremy Brown
 
The Rest Architectural Style
The Rest Architectural StyleThe Rest Architectural Style
The Rest Architectural StyleRobert Wilson
 
Building Ext JS Using HATEOAS - Jeff Stano
Building Ext JS Using HATEOAS - Jeff StanoBuilding Ext JS Using HATEOAS - Jeff Stano
Building Ext JS Using HATEOAS - Jeff StanoSencha
 
JSON based CSRF
JSON based CSRFJSON based CSRF
JSON based CSRFAmit Dubey
 
Finding knowledge, data and answers on the Semantic Web
Finding knowledge, data and answers on the Semantic WebFinding knowledge, data and answers on the Semantic Web
Finding knowledge, data and answers on the Semantic Webebiquity
 
2010 06 ipaw_prv
2010 06 ipaw_prv2010 06 ipaw_prv
2010 06 ipaw_prvJun Zhao
 
The Future is Now: What’s New in ForgeRock Directory Services
The Future is Now: What’s New in ForgeRock Directory ServicesThe Future is Now: What’s New in ForgeRock Directory Services
The Future is Now: What’s New in ForgeRock Directory ServicesForgeRock
 
Hypermedia APIs and HATEOAS / Wix Engineering
Hypermedia APIs and HATEOAS / Wix EngineeringHypermedia APIs and HATEOAS / Wix Engineering
Hypermedia APIs and HATEOAS / Wix EngineeringVladimir Tsukur
 
RDFa Introductory Course Session 2/4 How RDFa
RDFa Introductory Course Session 2/4 How RDFaRDFa Introductory Course Session 2/4 How RDFa
RDFa Introductory Course Session 2/4 How RDFaPlatypus
 

Similar to xcap (20)

Phalcon 2 High Performance APIs - DevWeekPOA 2015
Phalcon 2 High Performance APIs - DevWeekPOA 2015Phalcon 2 High Performance APIs - DevWeekPOA 2015
Phalcon 2 High Performance APIs - DevWeekPOA 2015
 
A Conversation About REST
A Conversation About RESTA Conversation About REST
A Conversation About REST
 
A Conversation About REST
A Conversation About RESTA Conversation About REST
A Conversation About REST
 
Salesforce REST API
Salesforce  REST API Salesforce  REST API
Salesforce REST API
 
Restful webservices
Restful webservicesRestful webservices
Restful webservices
 
Java Script Based Client Server Webapps 2
Java Script Based Client Server Webapps 2Java Script Based Client Server Webapps 2
Java Script Based Client Server Webapps 2
 
A Conversation About REST - Extended Version
A Conversation About REST - Extended VersionA Conversation About REST - Extended Version
A Conversation About REST - Extended Version
 
The Rest Architectural Style
The Rest Architectural StyleThe Rest Architectural Style
The Rest Architectural Style
 
Building Ext JS Using HATEOAS - Jeff Stano
Building Ext JS Using HATEOAS - Jeff StanoBuilding Ext JS Using HATEOAS - Jeff Stano
Building Ext JS Using HATEOAS - Jeff Stano
 
ReSTful API Final
ReSTful API FinalReSTful API Final
ReSTful API Final
 
80068
8006880068
80068
 
REST API
REST APIREST API
REST API
 
JSON based CSRF
JSON based CSRFJSON based CSRF
JSON based CSRF
 
Finding knowledge, data and answers on the Semantic Web
Finding knowledge, data and answers on the Semantic WebFinding knowledge, data and answers on the Semantic Web
Finding knowledge, data and answers on the Semantic Web
 
2010 06 ipaw_prv
2010 06 ipaw_prv2010 06 ipaw_prv
2010 06 ipaw_prv
 
The Future is Now: What’s New in ForgeRock Directory Services
The Future is Now: What’s New in ForgeRock Directory ServicesThe Future is Now: What’s New in ForgeRock Directory Services
The Future is Now: What’s New in ForgeRock Directory Services
 
Hypermedia APIs and HATEOAS / Wix Engineering
Hypermedia APIs and HATEOAS / Wix EngineeringHypermedia APIs and HATEOAS / Wix Engineering
Hypermedia APIs and HATEOAS / Wix Engineering
 
RDFa Introductory Course Session 2/4 How RDFa
RDFa Introductory Course Session 2/4 How RDFaRDFa Introductory Course Session 2/4 How RDFa
RDFa Introductory Course Session 2/4 How RDFa
 
How RDFa works
How RDFa worksHow RDFa works
How RDFa works
 
WIT UNIT-5.pdf
WIT UNIT-5.pdfWIT UNIT-5.pdf
WIT UNIT-5.pdf
 

Recently uploaded

main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZTE
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxvipinkmenon1
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2RajaP95
 

Recently uploaded (20)

main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptx
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
 

xcap

  • 1. XCAP The Extensible Markup Language (XML) Configuration Access Protocol (XCAP) 邱振剛
  • 2. What is XCAP? 2  XCAP能夠讓使用者讀取、新增、修改儲存在 Server上的好友資料(XML格式)  XCAP能將XML文件內的元素、屬性等,映射 到HTTP URI  XCAP在Presence System中的應用  Buddy Lists  Authorization Policies  Hard state presence data
  • 3. Buddy List Use Case  Client wants to subscribe to a list of users  Send SUBSCRIBE to server using SIP event list extension  Server retrieves list associated with buddylist URI  Generates SUBSCRIBEs to them  Client can manage that list  Add, remove, modify entries Subscribe Joe Subscribe Bob Subscribe Mary Subscribe List Read List Write List Data Manipulation Server Client Standard Ifaces Hiroshi Hiroshi
  • 4. Authorization Use Case  User Hiroshi subscribes to Petri  No auth policy in place, generates a winfo NOTIFY to Petri  Petri needs to be able to set authorization decision for Hiroshi  Want to be able to set such policies outside of a subscription as well Subscribe Petri Read List Write List Data Manipulation Server Client Standard Ifaces winfo Hiroshi Petri
  • 5. Hard State Presence Management  Hiroshi subscribes to Petri  Petri has been offline for weeks  Server sends NOTIFY with current presence state  Petri wants to control default state when offline  Set it to <activity>vacation</activit y> Subscribe Petri Read PIDF Write PIDF Data Manipulation Server Client Standard Ifaces Notify Hiroshi Petri
  • 6. XML-Extensible Markup Language(1/2) 6  能夠建立特殊標記的通用標記語言。  <name>、<phone>、<姓名>、<電話>  XML 是屬於純本文的資料,因此適合做資訊交換使用。  XML著重在如何將文件資料以結構化的方式來表示, HTML著重在如何將文件顯示在瀏覽器中。  XML有簡明的語法和明確的結構,無論是對人或程式,讀 取和解析都很簡單。
  • 7. <?xml version="1.0" encoding="UTF-8"?> <resource-lists> <list name="friends"> <entry uri="sip:bob@example.com"> <name>Bob Jones</name> </entry> </list> <other/> </resource-lists> </xml> <?xml version="1.0" encoding="UTF-8"?> <resource-lists> <list name="friends"> <entry uri="sip:bob@example.com"> <name>Bob Jones</name> </entry> </list> <other/> </resource-lists> </xml> XML-Extensible Markup Language(2/2) 7  XML Document: 如左為XML文 檔,被設計用來傳輸和儲存資料。  XML element: <list>…</list>, 元素也可空元素<other/>  XML Attributes: 可以將元素加入 標籤,提供額外的訊息內容。 XML Document: 如左為XML文 檔。 XML element: <list>…</list>, 元素也可空元素<other/>。 XML Attributes: 可以將元素加 入標籤,提供額外的訊息內容 <?xml version="1.0" encoding="UTF-8"?> <resource-lists> <list name="friends"> <entry uri="sip:bob@example.com"> <name>Bob Jones</name> </entry> </list> <other/> </resource-lists> </xml> <?xml version="1.0" encoding="UTF-8"?> <resource-lists"> <list name="friends"> <entry uri="sip:bob@example.com"> <name>Bob Jones</name> </entry> </list> <other/> </resource-lists> </xml>
  • 8. XPath 8  XPath = XML Addressing  XPath 是在 XML 檔案中查找訊息的語言。  XPath 可用在 XML 檔案中對元素和屬性進行瀏覽。  Positional Selectors resource- lists/list/entry/name <?xml version="1.0" encoding="UTF-8"?> <resource-lists"> <list name="friends"> <entry uri="sip:bob@example.com"> <name>Bob Jones</name> </entry> </list> </resource-lists> resource-lists/list/entry/@uri
  • 9. XML Namespaces (1/2) 9  減少定義不明的元素,讓元素 具有唯一性。  如左圖XML文件中有兩個 <state>標籤,而程式指定 <state>時該如何區分? <?xml version="1.0" encoding="UTF-8"?> <address-book> <!—This guy is a bozo -- <entry> <name>Jonathan Rosenberg</name> <email>jdrosen@dynamicsoft.com</email> <postal> <street paved=“true”>600 Lanidex Pl</street> <city>Parsippany</city> <state>NJ</state> <country>USA</country> </postal> <state>synchronized</state> <ietf-participant/> </entry> </address-book>
  • 10. XML Namespaces (2/2) 10  解決方式:  使用XML Namespaces  Namespaces利用單一 的URI定義  定義好的名稱,在所屬 元素前,利用冒號與元 素名相接。  XML解析器不會對定義 的URI有任何動作,XML 解析器只判斷是否為唯 一值。 <?xml version="1.0" encoding="UTF-8"? xmlns:post=“http://www.post.com” xmlns:sync=“http://www.sync.com”> <post:address-book> <!—This guy is a bozo -- <post:entry> <post:name>Jonathan Rosenberg</post:name> <post:email>jdrosen@dynamicsoft.com</post:email> <post:postal> <post:street paved=“true”>600 Lanidex Pl</post:street> <post:city>Parsippany</post:city> <post:state>NJ</post:state> <post:country>USA</post:country> </post:postal> <post:ietf-participant/> <sync:state>synchronized</sync:state> </post:entry> </post:address-book>
  • 11. XML Schema 11  描述與限定XML文件的結構:  包含哪些元素(elements)、屬性(attributes)  元素的順序與重複性  限定每個元素與屬性的資料型態與值域  xs:string  xs:decimal  xs:integer  xs:boolean  xs:date  xs:time 0~99的整數 xs:minInclusive xs:maxInclusive <xs:element name="age"> <xs:simpleType> <xs:restriction base="xs:integer"> <xs:minInclusive value="0"/> <xs:maxInclusive value="100"/> </xs:restriction> </xs:simpleType> </xs:element>
  • 12. 12 <?xml version="1.0" encoding="UTF-8"?> <xs:schema targetNamespace="http://www.post.com" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.post.com" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:element name="address-book"> <xs:complexType> <xs:sequence> <xs:element name="entry" minOccurs="0" maxOccurs="unbounded"> <xs:complexType> <xs:sequence> <xs:element name="name" type="xs:string"/> <xs:element name="email" type="xs:string"/> <xs:element name="postal"> <xs:complexType> <xs:sequence> <xs:element name="street" type="xs:string"/> <xs:element name="city" type="xs:string"/> <xs:element name="state"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="NJ"/> <xs:enumeration value="NY"/> </xs:restriction> </xs:simpleType> </xs:element> <xs:element name="country" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="ietf-participant"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> XML Schema <?xml version="1.0" encoding="UTF-8"?> <address-book> <!—This guy is a bozo -- <entry> <name>Jonathan Rosenberg</name> <email>jdrosen@dynamicsoft.com</email> <postal> <street paved=“true”>600 Lanidex Pl</street> <city>Parsippany</city> <state>NJ</state> <country>USA</country> </postal> <ietf-participant/> </entry> </address-book>
  • 13. Application Usage(1/5) 13  Each application has its own Application Usage  Define how the XCAP server can manipulate corresponding application documents  Key components:  AUID  XML Schema  Data Semantics  Resource Interdependency  Authorization Policies
  • 14. 14  Application Unique ID  Unique Identifier for each application  Two sub-namespaces  IETF tree  Example : “resource-lists” , “pidf- manipulation” , “pres-rules”  Vendor tree:  prefixed with the reverse domain name of the organization  Example: “com.example.customer-list” Application Usage(2/5)
  • 15. 15  Data Semantics  An address book is a series of <entry> elements  Each <entry> is information about an entry in the address book  It has a <name>, which is the use persons first and last name  It has an <email> element, which contains the email address of the person  It has a <postal> element that has the postal address Application Usage(3/5)
  • 16. 16  Resource interdependency  Operation of one element may affect other elements; especially cross-document affection Application Usage(4/5)  Think of the application usage as a client of XCAP  Handset puts a new resource list (1)  Application learns of change (4)  Acting as a client, application modifies data(5)
  • 17. 17  Authorization policies  User can read & write their own data  User can only read global data  Global data is readable by everyone, writeable by no one except privileged users Application Usage(5/5)
  • 18. URI Construction 18 Based on the Concept of XPath Example: XCAP root / Document Selector / Node Selector  XCAP root Context in which all other resources exist "http://xcap.example.com" for domain "example.com "  Document Selector "/resource-lists/users/sip:joe@example.com/index"  Node Selector ~~/resource-lists/list%5b@name=%22l1%22%5d
  • 19. XCAP URI的樹狀結構 <?xml version="1.0" encoding="UTF-8"?> <resource-lists xmlns="urn:ietf:params:xml:ns:resource-lists"> <list name="friends"> <entry uri="sip:bob@example.com"> <name>Bob Jones</name> </entry> <list name="close-friends"> <entry uri="sip:hiroshi@example.com"> <name>Hiroshi Aukia</name> </entry> </list> </list> </resource-lists> GET http://xcap.example.com/ resource-lists/users/hiroshi/buddlist/ ~~/resource-lists/list/list/entry/name
  • 20. Operations 20  HTTP PUT Create or Replace a Document/Element/Attribute  HTTP DELETE Delete a Document/Element/Attribute  HTTP GET Fetch a Document/Element/Attribute
  • 21. Fetching a Document GET http://xcap.example.com/address-book/users/petri/adbook1 HTTP/1.1 HTTP/1.1 200 OK Content-Type: application/adbook+xml Content-Length: … <?xml version="1.0" encoding="UTF-8"?> <address-book> <!—This guy is a bozo -- <entry> <name>Jonathan Rosenberg</name> <email>jdrosen@dynamicsoft.com</email> <postal> <street paved=“true”>600 Lanidex Pl</street> <city>Parsippany</city> <state>NJ</state> <country>USA</country> </postal> <ietf-participant/> </entry> </address-book> <?xml version="1.0" encoding="UTF-8"?> <address-book> <!—This guy is a bozo -- <entry> <name>Jonathan Rosenberg</name> <email>jdrosen@dynamicsoft.com</email> <postal> <street paved=“true”>600 Lanidex Pl</street> <city>Parsippany</city> <state>NJ</state> <country>USA</country> </postal> <ietf-participant/> </entry> </address-book> adbook1
  • 22. Fetching an Element GET http://xcap.example.com/address-book/users/petri/adbook1/ address-book/entry/name HTTP/1.1 HTTP/1.1 200 OK Content-Type: application/xml-fragment-body Content-Length: … <name>Jonathan Rosenberg</name> <?xml version="1.0" encoding="UTF-8"?> <address-book> <!—This guy is a bozo -- <entry> <name>Jonathan Rosenberg</name> <email>jdrosen@dynamicsoft.com</email> <postal> <street paved=“true”>600 Lanidex Pl</street> <city>Parsippany</city> <state>NJ</state> <country>USA</country> </postal> <ietf-participant/> </entry> </address-book> adbook1
  • 23. Fetching an Attribute GET http://xcap.example.com/address-book/users/petri/adbook1/ address-book/entry/street/@paved HTTP/1.1 HTTP/1.1 200 OK Content-Type: application/xml-attribute-value Content-Length: … true <?xml version="1.0" encoding="UTF-8"?> <address-book> <!—This guy is a bozo -- <entry> <name>Jonathan Rosenberg</name> <email>jdrosen@dynamicsoft.com</email> <postal> <street paved=“true”>600 Lanidex Pl</street> <city>Parsippany</city> <state>NJ</state> <country>USA</country> </postal> <ietf-participant/> </entry> </address-book> adbook1
  • 24. Delete a Document DELETE http://xcap.example.com/address-book/users/petri/adbook1 HTTP/1.1 HTTP/1.1 200 OK <?xml version="1.0" encoding="UTF-8"?> <address-book> <!—This guy is a bozo -- <entry> <name>Jonathan Rosenberg</name> <email>jdrosen@dynamicsoft.com</email> <postal> <street paved=“true”>600 Lanidex Pl</street> <city>Parsippany</city> <state>NJ</state> <country>USA</country> </postal> <ietf-participant/> </entry> </address-book> adbook1 NULL
  • 25. Deleting an Element DELETE http://xcap.example.com/address- book/users/petri/adbook1/ address-book/entry/name/email HTTP/1.1 HTTP/1.1 200 OK <?xml version="1.0" encoding="UTF-8"?> <address-book> <!—This guy is a bozo -- <entry> <name>Jonathan Rosenberg</name> <email>jdrosen@dynamicsoft.com</email> <postal> <street paved=“true”>600 Lanidex Pl</street> <city>Parsippany</city> <state>NJ</state> <country>USA</country> </postal> <ietf-participant/> </entry> </address-book> adbook1 <?xml version="1.0" encoding="UTF-8"?> <address-book> <!—This guy is a bozo -- <entry> <name>Jonathan Rosenberg</name> <postal> <street paved=“true”>600 Lanidex Pl</street> <city>Parsippany</city> <state>NJ</state> <country>USA</country> </postal> <ietf-participant/> </entry> </address-book>
  • 26. Deleting an Attribute DELETE http://xcap.example.com/address- book/users/petri/adbook1/ address- book/entry/name/postal/street/@paved HTTP/1.1 HTTP/1.1 200 OK <?xml version="1.0" encoding="UTF-8"?> <address-book> <!—This guy is a bozo -- <entry> <name>Jonathan Rosenberg</name> <email>jdrosen@dynamicsoft.com</email> <postal> <street paved=“true”>600 Lanidex Pl</street> <city>Parsippany</city> <state>NJ</state> <country>USA</country> </postal> <ietf-participant/> </entry> </address-book> adbook1 <?xml version="1.0" encoding="UTF-8"?> <address-book> <!—This guy is a bozo -- <entry> <name>Jonathan Rosenberg</name> <postal> <street>600 Lanidex Pl</street> <city>Parsippany</city> <state>NJ</state> <country>USA</country> </postal> <ietf-participant/> </entry> </address-book>
  • 27. 新增、修改 27  兩個操作都是使用PUT Request操作文件的內容。  Server 根據 URI 檢查的方式如下  解析URI並檢查,文件是否存在、元素是否存在、屬性是 否存在  不存在就新增 : 新增到同階層的位置  存在就修改 : 根據URI修改替換舊資料
  • 28. Add an Element PUT http://xcap.example.com/address- book/users/petri/adbook1/ address-book/entry/phone HTTP/1.1 Content-Type: application/xml-fragment-body <phone>+19739525000</phone> HTTP/1.1 200 OK <?xml version="1.0" encoding="UTF-8"?> <address-book> <!—This guy is a bozo -- <entry> <name>Jonathan Rosenberg</name> <email>jdrosen@dynamicsoft.com</email> <postal> <street paved=“true”>600 Lanidex Pl</street> <city>Parsippany</city> <state>NJ</state> <country>USA</country> </postal> <ietf-participant/> </entry> </address-book> adbook1 <?xml version="1.0" encoding="UTF-8"?> <address-book> <!—This guy is a bozo -- <entry> <name>Jonathan Rosenberg</name> <phone>+19739525000</phone> <email>jdrosen@dynamicsoft.com</email> <postal> <street paved=“true”>600 Lanidex Pl</street> <city>Parsippany</city> <state>NJ</state> <country>USA</country> </postal> <ietf-participant/> </entry> </address-book>
  • 29. Modify an Element PUT http://xcap.example.com/address- book/users/petri/adbook1/ address-book/entry/name HTTP/1.1 Content-Type: application/xml-fragment-body <name>Jonathan D. Rosenberg</name> HTTP/1.1 200 OK <?xml version="1.0" encoding="UTF-8"?> <address-book> <!—This guy is a bozo -- <entry> <name>Jonathan Rosenberg</name> <email>jdrosen@dynamicsoft.com</email> <postal> <street paved=“true”>600 Lanidex Pl</street> <city>Parsippany</city> <state>NJ</state> <country>USA</country> </postal> <ietf-participant/> </entry> </address-book> adbook1 <?xml version="1.0" encoding="UTF-8"?> <address-book> <!—This guy is a bozo -- <entry> <name>Jonathan D. Rosenberg</name> <email>jdrosen@dynamicsoft.com</email> <postal> <street paved=“true”>600 Lanidex Pl</street> <city>Parsippany</city> <state>NJ</state> <country>USA</country> </postal> <ietf-participant/> </entry> </address-book>
  • 30. Conditional Operation 30  若多方對同一個XML檔進行編輯時,就會發生的衝 突。  ETag : 可以讓client端與server端的資源關聯記號 (token)。  配合HTTP定義的header  if-Match : 若符合,則進行程序  if-Non-Match : 若不符合,則進行程序  衝突發生時,Server回傳 412 condition fails
  • 31. 流程範例 31  User A has version ABC  Adds buddy, adds If- Match: ABC  Buddy added, new version DEF  User B also has version ABC  Tries to modify it, but it fails  B can now fetch it and make its diff against the current version
  • 32. Security Considerations 32  Data manipulated by XCAP often contains sensitive information  Using HTTP port: 80 – Hard to apply port-based filtering
  • 33. Solutions 33  Connection over TLS(Transport Layer Security)  HTTP Digest Authentication  Authorization policies in Application Usage
  • 34. Conclusion 34  Access configuration documents on server: Presence system  Maps XML documents and document components into HTTP URIs  HTTP primitives can be used to directly manipulate the data

Editor's Notes

  1. http://sipsimpleclient.com/wiki/sip_subscribe_winfo#sip-subscribe-winfo
  2. http://www.google.com.tw/url?sa=t&source=web&cd=3&ved=0CDkQFjAC&url=http%3A%2F%2Fwww.ec.ccu.edu.tw%2Fbook%2Fxml%2Fslidec%2Fch6.ppt&ei=rr9CTrr6B-igmQWs8_yrCQ&usg=AFQjCNHNsdSAKQ4CsWexcWBaI8Ea7UJ2Rg&sig2=xFnuepjMT-74BcKJgDeHZQ
  3. http://www.w3school.com.cn/schema/index.asp
  4. http://www.kuqin.com/web/20080513/8442.html