Runtime tools : Channels components : AJAX channel : Tasks : Defining the request data format
  
Defining the request data format
JSON Channel
Following is a code example for JSON request:
Note The definitions are referred to in the channel handler definition section and channel framework. You can define them in your corresponding configuration files before using the JSON channel. The JSON channel cannot work without those definitions.
{“xml_request”:{“action”:”myFullAction”,”data_formatter”:“myDataFormatter”,” response_formatter”:” myResponseFormatter”,”data”:”myData”}}
On the server side, JSON channel framework uses the UNICOM® Digital Transformation Toolkit (UDTT™) JSON formatter to parse the request JSON and transfer it to channel context.
Following are the data definitions used by JSON channel framework:
<!-- =====================JSON Channel======================= -->
<kColl id="json_request">
<field id="action" />
<field id="data_formatter" />
<field id="response_formatter" />
<field id="data" />
</kColl>
<kColl id="jsonl_reply">
<field id="status" />
<field id="result" />
<field id="sessionId" />
</kColl>
<kColl id="json_sessionReply">
<field id="status" />
<field id="sessionId" />
<field id="timeout" />
</kColl>
The context definitions:
<!-- The contexts are used in web2.0 JSON channel -->
<context id="JSONChannelContext" type="op">
<refKColl refId="json_request" />
</context>
<context id="JSONReplyContext" type="op">
<refKColl refId="json_reply" />
</context>
<context id="JSONSessionReplyContext" type="op">
<refKColl refId="json_sessionReply" />
</context>
The formatter definitions:
<!-- ===============JSON Channel ==================== -->
<fJSON id="JSONChannelFormatter">
<record dataName="json_request">
<fString dataName="action" />
<fString dataName="data_formatter" />
<fString dataName="response_formatter" />
<fString dataName="data" escape="true" />
</record>
</fJSON>
<fJSON id="JSONReplyFormatter">
<record dataName="json_reply">
<fString dataName="status" />
<fJSONObj dataName="result" />
<fString dataName="sessionId" />
</record>
</fJSON
<fJSON id="JSONSessionReplyFormatter">
<record dataName="json_sessionReply">
<fString dataName="status" />
<fString dataName="sessionId" />
<fString dataName="timeout" />
</record>
</fJSON>
Go up to
Tasks