![]() ![]() |
|
jCML Communication ProtocolThe jBASE Remote Connectivity Layer defines a communication protocol, which the client library uses to send requests to and receive replies from the remote server process. The protocol is based on Extensible Mark-up Language (XML) and will be named JCML (jBASE Communication Mark-up Language). The structure of JCML is discussed further in this section and is based on the following assumptions:
Overall Structure of JCMLJCML mark-up incorporates several tags, defining the structure of the message. The tags are listed in the following table:
The valid message formats in JCML are defined below. The Request for Service Message Request for service is the message sent by the client library to the remote server to initiate a service request (remote function call). The format of the message is as follows:
Example: <?xml version="1.0" encoding="UTF-16"?> <jcml src="client" type="req"> <obj>0</obj> <cmd>oconv</cmd> <data enc="esc">Test</data> <data enc="esc">MCU</data> </jcml> The XML fragment above calls the function oconv in object 0 (connection object) and passing it string "Test" as the first parameter and string "MCU" as the second parameter.
Service Reply The service reply message is sent by the remote server after the processing of the client‟s request is completed. The message is formatted as follows:
Example: <?xml version="1.0" encoding="UTF-16"?> <jcml src="server" type="reply"> <stat id="0"></stat> <data enc="esc">TEST</data> </jcml> This example illustrates a possible server reply to the sample request constructed in previous section. It instructs the client that the server function has completed with status code of 0, no error messages, and the return value is "TEST".
Terminal Output This message may be sent by the server to the client while the request for service is being executed. It indicates that the server has generated terminal output during the course of its processing and is supplying the output to the client. This message requires neither acknowledgement nor a reply. The structure of the message is as follows:
Example: <?xml version="1.0" encoding="UTF-16"?> <jcml src="server" type="termout"> <data enc="base64">VGVzdCBvdXRwdXQK</data> </jcml> This example illustrates a terminal output message from the remote server supplying a base64-encoded string "Test output" to the client.
Request for Input A request for input is sent to the client when the server encounters a command requiring terminal input while processing the client request. This message requires the client to send back a terminal input message with input characters for the server process. The request for input is typically formatted as follows:
Example: <?xml version="1.0" encoding="UTF-16"?> <jcml src="server" type="prompt"> <data enc="esc">100</data> </jcml> This example illustrates the server request for at most 100 characters to be returned from the client.
Terminal Input The terminal input message is sent by the client in response to the server‟s request for input. This message has the following format:
Example: <?xml version="1.0" encoding="UTF-16"?> <jcml src="client" type="termin"> <data enc="base64">VGVzdCBpbnB1dAo=</data> </jcml> This example illustrates a terminal input message sent to the server with base64-encoded string "Test input" as input.
jBASE Remote Connectivity Service |