private string getResponseHeader(String content_type, String session_id)
{
double time = getTimeStamp();
String xml_header = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
xml_header += "<messages version='1.0' sessionid='" + session_id + "'>";
/*
JSON Response schema:
version: the version of the Appcelerator protocol
encoding: the text encoding of the message (generally UTF-8)
sessionid: (optional) the session id of the current session
time: the timestamp of this response in ISO 8601 format with timezone specified
messages: (an array of objects conforming to the message schema below
*/
String json_header = "{version:'1.1',encoding:'UTF-8',sessionid:'" + session_id + "',timestamp:" + time + ",messages:[";
String header = "";
switch (content_type)
{
case ServiceBroker.APPLICATION_JSON:
header = json_header;
break;
case ServiceBroker.XML_JSON:
header = xml_header;
break;
}
return header;
}