Applied Informatics Remoting

Remoting JSON-RPC Transport User Guide

Contents

Introduction

The JSON Transport is a very lightweight HTTP-based Transport implementation, supporting the JSON-RPC 2.0 protocol specification.

Basic JSON Transport Usage

Server Usage

To use the JSON Transport in a server, the following three steps must be performed:

  1. register the Poco::Remoting::JSON::TransportFactory with the ORB,
  2. register a Poco::Remoting::JSON::Listener with the ORB, and finally,
  3. register the individual objects with the ORB.

Following is an example code fragment for setting up a JSON Transport listener, and registering a service object for use with the listener.

Poco::Remoting::JSON::TransportFactory::registerFactory();
Poco::Remoting::ORB::instance().registerListener(
    new PocoRemoting::JSON::Listener(8080)
);
std::string uri = MyProject::MyClassHelper::registerObject(
    new MyProject::MyClass, 
    "MyObject", 
    8080, 
    Poco::Remoting::JSON::Transport::ID
);

Client Usage

To use the JSON Transport in a client, the following two steps must be performed:

  1. register the Poco::Remoting::JSON::TransportFactory with the ORB, and
  2. retrieve the interface (proxy) object using the helper class.

Following is an example code fragment for setting up a JSON Transport, and registering a service object for use with the transport.

Poco::Remoting::JSON::TransportFactory::registerFactory();
MyProject::IMyClass::Ptr ptrObj = MyProject::MyClassHelper::findObject(
    hostName, 
    "MyObject", 
    8080, 
    Poco::Remoting::JSON::Transport::ID
);

Interoperability Issues

The Remoting JSON Transport should work well with other JSON-RPC client or server implementations, provided they support passing parameters by-name (as object). The Remoting JSON Transport cannot handle parameters passed by-position (as JSON array). Furthermore, the JSON Transport does not support batched requests.