Difference between revisions of "Xebra Module Communication Protocol"
(→Request Message) |
(→Example) |
||
(14 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
[[Category:Xebra]] | [[Category:Xebra]] | ||
+ | [[Xebra About|About]] | [[Xebra Installation|Installation]] | [[Xebra Documentation|Documentation]] | [[Xebra Tutorial|Tutorials]] | [[Xebra FAQ|Frequently Asked Questions]] | ||
+ | |||
=Basic Communication= | =Basic Communication= | ||
Line 13: | Line 15: | ||
For every request, the module sends a message of the following format to the server: | For every request, the module sends a message of the following format to the server: | ||
<code> | <code> | ||
− | REQUEST = | + | REQUEST = HEADER HEADERS_IN HEADERS_OUT SUBPROCESS_ENVIRONMENT_VARS ARGS; |
− | + | ||
− | + | HEADER = KEY_METHOD KEY_SPACE url KEY_SPACE KEY_HTTP; | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | HEADER = | + | |
− | + | ||
HEADERS_IN = KEY_HI {TABLE_ENTRY} KEY_END; | HEADERS_IN = KEY_HI {TABLE_ENTRY} KEY_END; | ||
− | |||
HEADERS_OUT = KEY_HO {TABLE_ENTRY} KEY_END; | HEADERS_OUT = KEY_HO {TABLE_ENTRY} KEY_END; | ||
SUBPROCESS_ENVIRONMENT_VARS = KEY_SE TABLE_ENTRIES KEY_END; | SUBPROCESS_ENVIRONMENT_VARS = KEY_SE TABLE_ENTRIES KEY_END; | ||
TABLE_ENTRY = KEY_T_NAME item_name KEY_T_VALUE item_value; | TABLE_ENTRY = KEY_T_NAME item_name KEY_T_VALUE item_value; | ||
+ | ARGS = KEY_ARG args; | ||
− | |||
− | |||
− | + | KEY_METHOD = "GET" | "POST"; | |
− | + | KEY_HTTP = "HTTP/1.1" | "HTTP/1.0"; | |
− | + | ||
− | KEY_HTTP = "HTTP/1.1"; | + | |
KEY_SPACE = " "; | KEY_SPACE = " "; | ||
KEY_HI = "#HI#"; | KEY_HI = "#HI#"; | ||
Line 43: | Line 35: | ||
KEY_T_VALUE = "#%#"; | KEY_T_VALUE = "#%#"; | ||
KEY_ARG = "#A#"; | KEY_ARG = "#A#"; | ||
− | + | </code> | |
− | + | ||
− | + | ||
− | + | ||
+ | ==Example== | ||
+ | |||
+ | GET request with arguments | ||
+ | |||
+ | <code> | ||
+ | GET /test.xeb?name=admin&password=plain_text&login=true HTTP/1.1#HI##$#Host#%#localhost:55000#$#User-Agent#%#Mozilla/5.0 (X11; U; Linux x86_64; en; rv:1.9.0.11) Gecko/20080528 Epiphany/2.22 Firefox/3.0#$#Accept#%#text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8#$#Accept-Language#%#en-us,en;q=0.5#$#Accept-Encoding#%#gzip,deflate#$#Accept-Charset#%#ISO-8859-1,utf-8;q=0.7,*;q=0.7#$#Keep-Alive#%#300#$#Connection#%#keep-alive#E##HO##E##SE##E##A#&name=admin&password=plain_text&login=true | ||
</code> | </code> | ||
− | + | GET request with cookies | |
+ | |||
<code> | <code> | ||
− | GET /demoapplication/reservations.xeb HTTP/1.1#HI##$#Host#%#localhost:55000#$#User-Agent#%#Mozilla/5.0 (X11; U; Linux x86_64; en; rv:1.9.0.11) Gecko/20080528 Epiphany/2.22 Firefox/3.0#$#Accept#%#text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8#$#Accept-Language#%#en-us,en;q=0.5#$#Accept-Encoding#%#gzip,deflate#$#Accept-Charset#%#ISO-8859-1,utf-8;q=0.7,*;q=0.7#$#Keep-Alive#%#300#$#Connection#%#keep-alive#$#Referer#%#http://localhost:55000/demoapplication/ | + | GET /demoapplication/reservations.xeb HTTP/1.1#HI##$#Host#%#localhost:55000#$#User-Agent#%#Mozilla/5.0 (X11; U; Linux x86_64; en; rv:1.9.0.11) Gecko/20080528 Epiphany/2.22 Firefox/3.0#$#Accept#%#text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8#$#Accept-Language#%#en-us,en;q=0.5#$#Accept-Encoding#%#gzip,deflate#$#Accept-Charset#%#ISO-8859-1,utf-8;q=0.7,*;q=0.7#$#Keep-Alive#%#300#$#Connection#%#keep-alive#$#Referer#%#http://localhost:55000/demoapplication/reservations.xeb#$#Cookie#%#xuuid=1B9314C9-B147-406C-BB80-7E9572D53B18; place=eiffelstudio, hollister avenue #3 =her; webapp=demoapplication; 123=46; asldasda=asdasd#E##HO##E##SE##E##A# |
+ | </code> | ||
+ | POST request with form arguments | ||
+ | |||
+ | <code> | ||
+ | POST /test.xeb HTTP/1.1#HI##$#Host#%#10.0.10.117:55000#$#Connection#%#keep-alive#$#User-Agent#%#Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/530.5 (KHTML, like Gecko) Chrome/2.0.172.33 Safari/530.5#$#Content-Length#%#48#$#Cache-Control#%#max-age=0#$#Origin#%#file://#$#Content-Type#%#application/x-www-form-urlencoded#$#Accept#%#application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5#$#Accept-Encoding#%#gzip,deflate,bzip2,sdch#$#Accept-Language#%#de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4#$#Accept-Charset#%#ISO-8859-1,utf-8;q=0.7,*;q=0.3#E##HO##E##SE##E##A#&name=wer&test=on&hiddenField=first&submit=Submit | ||
+ | </code> | ||
+ | |||
+ | XML-RPC POST request | ||
+ | |||
+ | <code> | ||
+ | POST /xmlrpc_demo/demo.xrpc HTTP/1.0#HI##$#Host#%#localhost:55000#$#User-Agent#%#xmlrpclib.py/1.0.1 (by www.pythonware.com)#$#Content-Type#%#text/xml#$#Content-Length#%#192#E##HO##E##SE##E##A#&<?xml version='1.0'?> | ||
+ | <methodCall> | ||
+ | <methodName>demo.sum</methodName> | ||
+ | <params> | ||
+ | <param> | ||
+ | <value><int>4</int></value> | ||
+ | </param> | ||
+ | <param> | ||
+ | <value><int>5</int></value> | ||
+ | </param> | ||
+ | </params> | ||
+ | </methodCall> | ||
</code> | </code> | ||
Line 72: | Line 90: | ||
==Example== | ==Example== | ||
<code> | <code> | ||
− | + | #C#xuuid=0C580662-6ED1-4166-9084-7272E426CE63;Max-Age=1000;Version=1#CE##CT#text/html;charset=ascii#H#<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
+ | <html xmlns="http://www.w3.org/1999/xhtml"> | ||
+ | <head> | ||
+ | <title>Xebra Server Control</title> | ||
+ | </head> | ||
+ | <body> | ||
+ | hello | ||
+ | </body> | ||
+ | </html> | ||
</code> | </code> |
Latest revision as of 14:04, 10 August 2009
About | Installation | Documentation | Tutorials | Frequently Asked Questions
Basic Communication
For every string message that is to be sent between a module and server, the sender first sends the length of the message ENCODED_MESSAGE_LENGTH and then the message MESSAGE. The max length FRAG_SIZE of a message to be sent is 65536 bytes. If a message is longer, it is divided into fragments. ENCODED_MESSAGE_LENGTH is called ENCODED_ because it also contains a FRAG_FLAG which specifies if the next message is a fragment and has to be assembled to a whole message after receiving.
Let's say the server wants so send a message of size 150'000 bytes to the module. The following would be sent: [65536 FRAG_FLAG=1][Message part 1...][65536 FRAG_FLAG=1][Message part 2....][18928 FRAG_FLAG=0][Message part 3....]
The ENCODED_MESSAGE_LENGTH is constructed as follows: The lenght of the message (integer) is shifted by 1 bit to the left. Then the most right bit is set to FRAG_FLAG.
Request Message
For every request, the module sends a message of the following format to the server:
REQUEST = HEADER HEADERS_IN HEADERS_OUT SUBPROCESS_ENVIRONMENT_VARS ARGS; HEADER = KEY_METHOD KEY_SPACE url KEY_SPACE KEY_HTTP; HEADERS_IN = KEY_HI {TABLE_ENTRY} KEY_END; HEADERS_OUT = KEY_HO {TABLE_ENTRY} KEY_END; SUBPROCESS_ENVIRONMENT_VARS = KEY_SE TABLE_ENTRIES KEY_END; TABLE_ENTRY = KEY_T_NAME item_name KEY_T_VALUE item_value; ARGS = KEY_ARG args; KEY_METHOD = "GET" | "POST"; KEY_HTTP = "HTTP/1.1" | "HTTP/1.0"; KEY_SPACE = " "; KEY_HI = "#HI#"; KEY_HO = "#HO#"; KEY_END = "#E#"; KEY_SE = "#SE#"; KEY_T_NAME = "#$#"; KEY_T_VALUE = "#%#"; KEY_ARG = "#A#";
Example
GET request with arguments
GET /test.xeb?name=admin&password=plain_text&login=true HTTP/1.1#HI##$#Host#%#localhost:55000#$#User-Agent#%#Mozilla/5.0 (X11; U; Linux x86_64; en; rv:1.9.0.11) Gecko/20080528 Epiphany/2.22 Firefox/3.0#$#Accept#%#text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8#$#Accept-Language#%#en-us,en;q=0.5#$#Accept-Encoding#%#gzip,deflate#$#Accept-Charset#%#ISO-8859-1,utf-8;q=0.7,*;q=0.7#$#Keep-Alive#%#300#$#Connection#%#keep-alive#E##HO##E##SE##E##A#&name=admin&password=plain_text&login=true
GET request with cookies
GET /demoapplication/reservations.xeb HTTP/1.1#HI##$#Host#%#localhost:55000#$#User-Agent#%#Mozilla/5.0 (X11; U; Linux x86_64; en; rv:1.9.0.11) Gecko/20080528 Epiphany/2.22 Firefox/3.0#$#Accept#%#text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8#$#Accept-Language#%#en-us,en;q=0.5#$#Accept-Encoding#%#gzip,deflate#$#Accept-Charset#%#ISO-8859-1,utf-8;q=0.7,*;q=0.7#$#Keep-Alive#%#300#$#Connection#%#keep-alive#$#Referer#%#http://localhost:55000/demoapplication/reservations.xeb#$#Cookie#%#xuuid=1B9314C9-B147-406C-BB80-7E9572D53B18; place=eiffelstudio, hollister avenue #3 =her; webapp=demoapplication; 123=46; asldasda=asdasd#E##HO##E##SE##E##A#
POST request with form arguments
POST /test.xeb HTTP/1.1#HI##$#Host#%#10.0.10.117:55000#$#Connection#%#keep-alive#$#User-Agent#%#Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/530.5 (KHTML, like Gecko) Chrome/2.0.172.33 Safari/530.5#$#Content-Length#%#48#$#Cache-Control#%#max-age=0#$#Origin#%#file://#$#Content-Type#%#application/x-www-form-urlencoded#$#Accept#%#application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5#$#Accept-Encoding#%#gzip,deflate,bzip2,sdch#$#Accept-Language#%#de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4#$#Accept-Charset#%#ISO-8859-1,utf-8;q=0.7,*;q=0.3#E##HO##E##SE##E##A#&name=wer&test=on&hiddenField=first&submit=Submit
XML-RPC POST request
POST /xmlrpc_demo/demo.xrpc HTTP/1.0#HI##$#Host#%#localhost:55000#$#User-Agent#%#xmlrpclib.py/1.0.1 (by www.pythonware.com)#$#Content-Type#%#text/xml#$#Content-Length#%#192#E##HO##E##SE##E##A#&<?xml version='1.0'?> <methodCall> <methodName>demo.sum</methodName> <params> <param> <value><int>4</int></value> </param> <param> <value><int>5</int></value> </param> </params> </methodCall>
Response Message
The server answers with a response message of the following format:
RESPONSE = {COOKIE_ORDER} CONTENT_TYPE HTML; COOKIE_ORDER = "#C#" cookie_name "=" cookie_value COOKIE_OPT ";Version=1#CE#"; COOKIE_OPT = [";" "Domain=" cookie_domain] [";" "Max-Age=" cookie_max_age] [";" "Path=" cookie_path] [";" "Secure"]; CONTENT_TYPE = "#CT#" content_type; HTML = "#H#" html_code;
Example
#C#xuuid=0C580662-6ED1-4166-9084-7272E426CE63;Max-Age=1000;Version=1#CE##CT#text/html;charset=ascii#H#<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Xebra Server Control</title> </head> <body> hello </body> </html>