JSONMessage
Overview
Implements JSON-RPC protocol. Data values are encoded in JSON format, binary streams are base64-encoded. Requires WrapResult option set to true at the server side.
Usage example
var channel = new RemObjects.SDK.HTTPClientChannel("http://" + window.location.host + "/JSON");
var message = new RemObjects.SDK.JSONMessage();
var service = new RemObjects.SDK.RemoteService(channel, message, "DASampleService");
Location
RemObjectsSDK.js
- Ancestry: Message | JSONMessage
Instance Methods
constructor JSONMessage
Creates an instance.
function constructor JSONMessage()
constructor Message (declared in Message)
No need to create an instance of abstract class.
function constructor Message()
clone
Returns new message object with the same ClienID.
function clone()
finalize
Finishes writing the data. Usually called by auto-generated code.
function finalize()
getClientID
Returns client id that identifies session on the server. Client id could be stored in some kind of persistent storage (like browser cookies) to be used after page reload.
function getClientID()
getErrorMessage
Returns error message as a string. Use it in the service methods error handler. See ClientChannel.dispatch.
function getErrorMessage()
initialize
Starts writing the data. Usually called by auto-generated code.
function initialize(aServiceName, aMethodName, aMessageType)
Parameters:
- aServiceName: string
- aMethodName: string
- aMessageType: number (RemObjects.SDK.Enum.MessageType)
read
Reads value from the data stream.
function read(aName, aType)
Parameters:
- aName: string
- aType: string
requestStream
Data stream to be sent to the server.
function requestStream()
setClientID
Sets ClientID.
var message = new RemObjects.SDK.JSONMessage();
message.setClientID(getCookie("MyAppClientID"));
function setClientID(aValue)
Parameters:
- aValue: string
write
Writes a value to the data stream.
function write(aName, aType, aValue)
Parameters:
- aName: string
- aType: string
- aValue: object