xfsp : cross format schema protocol flexible networking via xml-defined packet payloads ltjg. ekrem...
TRANSCRIPT
XFSP : Cross Format Schema ProtocolFlexible Networking via
XML-Defined Packet Payloads
Ltjg. Ekrem Serin
TU Navy
THE MOVES INSTITUTE 2
XFSP: Cross-Format Schema Protocol
Idea Extensible and Flexible Application Layer Protocol
Syntax Transactions via XML XML Serialization / Deserialization
Depending on Schema Knowledge
Target Area Net-VEs Web-based Applications XML-RPC
SOAP
THE MOVES INSTITUTE 3
XFSPBenefits
Schemas are tailored No need to hard code protocol syntax,
Compact XML, Platform-Independent (JAVA, XML), Hybrid Platform Communication
Application – Application Application - Web
Run-time Extensible Can be loaded or changed
THE MOVES INSTITUTE 4
XFSP
XML Data
XML Data XML
Data
Schema
Schema
Schema
Schema
Schema
Schema
Application
THE MOVES INSTITUTE 5
What is XML?
- A Tree- Where it can be traversed in pre-order, in-order
and post-order manners.
<?xml version="1.0" encoding="UTF-8"?><protocol xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="example.xsd">
<location x="3.45" y="56.72" z="-10.1"/><header>
<exerciseID>1</exerciseID><version>1</version><pdutype>2</pdutype>
</header><velocity x="1.0" y="0.0" z="-0.7"/>
</protocol>
THE MOVES INSTITUTE 6
XML Tree
version exerciseID
pduType
location
x
protocol
y z
header velocity
x y z
3.45 56.72
-10.1
1
2
11.0
0.0
-0.7
THE MOVES INSTITUTE 7
Parser APIs
- With Java 1.4 SAX API is provided- Start and End of Elements (event based)- Element names are created by the user- No tree representation
- JDOM- Tree Representation- Adapters (JAXP, Crimson, Oracle, Xerces,
XML4J)- Outputters (Text)
THE MOVES INSTITUTE 8
Parser APIs
- DOM4J- Tree Representation- Adapters- Outputters- Custom-type Object Binding- XPath Addressing
THE MOVES INSTITUTE 9
Schema
- A Protocol- Where it defines the data structure of the
XML documents for end-users.- Agreement.- Set of Rules.
THE MOVES INSTITUTE 10
Schema
THE MOVES INSTITUTE 11
AlgorithmXML Serialization
Parse the schema document. Create a look-up table for attributes and elements. Assign unique numbers to the elements and
attributes. Walk through the XML tree and put each element
and attribute into the output stream by replacing their tag names with numbers.
Preserves the content in binary form as compact XML.
THE MOVES INSTITUTE 12
Schema Parsing
Name Start Tag Number End Tag Number Datatype
/protocol 10 11 Null
/protocol/header 12 13 ComplexType
/protocol/location 14 15 ComplexType
/protocol/velocity 16 17 ComplexType
/protocol/header/version 18 19 XSDShort
/protocol/header/exerciseID 20 21 XSDByte
/protocol/header/pduType 22 23 XSDInteger
THE MOVES INSTITUTE 13
Schema Parsing
Name Tag Number Datatype
/protocol/location/@x 24 XSDDouble
/protocol/location/@y 25 XSDDouble
/protocol/location/@z 26 XSDDouble
/protocol/velocity/@x 27 XSDFloat
/protocol/velocity/@y 28 XSDFloat
/protocol/velocity/@z 29 XSDFloat
THE MOVES INSTITUTE 14
XML Serialization<?xml version="1.0" encoding="UTF-8"?><10 > <14 24="3.45" 25="56.72" 26="-10.1" 15> <12>
<20>1<21><18>1<19><22>2<23>
<13> <16 27="1.0" 28="0.0" 29="-0.7" 17><11>
10 14 1 24 3.45 25 56.72 26 -10.1 2 15
12 20 0 1 21 18 0 1 19 22 0
2 23 13 16 1 27 1.0 28 1.0 29 -0.7
2 17 11
THE MOVES INSTITUTE 15
Compression
389 383 378
118
0
50
100
150
200
250
300
350
400
450
1 2 3 4
In B
ytes
File JDOM DOM4J XFSP
THE MOVES INSTITUTE 16
Algorithm
XML Deserialization Read tag numbers from the stream. Retrieve element or attribute associated
with that number. Read the data. Create the elements, attributes and bind
data to them. Rebuild the XML tree. Retrieve data from the tree when needed.
THE MOVES INSTITUTE 17
Where to Use ?
- SOAP (Simple Object Access Protocol)- XML envelope for transactions- Send it compressed
<s:Envelope xmlns:s= “http://schemas.xmlsoap.org/soap/envelope/” xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance” xmlns:xsd="http://www.w3.org/1999/XMLSchema”> <s:Body> <m:sayHello xmlns:m=‘urn:Example’>
<name xsi:type=‘xsd:string’>Ekrem</name> </m:sayHello> </s:Body></s:Envelope>
THE MOVES INSTITUTE 18
Where to use ?
Application Code
Web
Service
Application Client
Platform and language specific
communication
Platform and language agnostic
communication
THE MOVES INSTITUTE 19
Binary X3D
- X3D is an XML file format describes a scene graph,
- Fairly heavyweight for Network Transmission,
- Can be compressed by designed algorithm,
- GZip Streams are used for further compression.
THE MOVES INSTITUTE 20
X3D Compression
THE MOVES INSTITUTE 21
X3D Compression / Decompression
Serializer
X3D Schema
X3D File B3D GZIP Stream
B3Z
GZIP Stream
X3D Schema
B3Z File B3D Deserializer X3D
THE MOVES INSTITUTE 22
Comparison in Kbytes
129
111
84
34 3329
0
20
40
60
80
100
120
140
x3d wrl b3d zip_x3d zip_wrl b3z
File Formats
Siz
e in
KB
yte
THE MOVES INSTITUTE 23
Comparison in Percentage
14
34
73 7478
0
10
20
30
40
50
60
70
80
90
wrl b3d zip_x3d zip_wrl b3z
File Formats
Sav
ings
in %
THE MOVES INSTITUTE 24
Rendering B3Z File
GZIP Stream
X3D Schema
B3Z File B3D File Deserializer
VRML97
X3D Stylesheet
Xj3D Browser
Transformer
X3D File
THE MOVES INSTITUTE 25
Rendering B3Z File
THE MOVES INSTITUTE 26
NPSNET-V
NPSNET-V : Run-time Extensible Networked Virtual Environment.
XFSP is embedded into the NPSNET-V as a network module. Networking is run-time extensible.
Packet formats are defined by using XML-Schema which is tailored to point the application layer protocol.
Framework is not targeted to define the semantics between protocol and application.
THE MOVES INSTITUTE 27
XFSP / ESPDU Packet Format
THE MOVES INSTITUTE 28
Detonation PDU Packet Format
THE MOVES INSTITUTE 29
Run-time Extensibility- ESPDU is loaded, no knowledge of Detonation PDU Syntax.
THE MOVES INSTITUTE 30
Run-time Extensibility- Detonation PDU Protocol is loaded at run-time.
THE MOVES INSTITUTE 31
XFSP
Demo / Questions ?