|
Oracle® On Track Communication SDK Documentation Release 1(1.0) E20955-01 |
|||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
The waggle.common.modules package contains the Waggle external API interfaces.
See:
Description
The waggle.common.modules package contains the Waggle external API interfaces. Each interface in this package has two nested interfaces: server
and client
. The server
interface specifies calls that can be made to the server; the client
interface specifies calls that can be made from the server to the client.
Server methods (that is, methods called by client) are synchronous, so a value can be returned to the caller. Client methods, on the other, are asynchronous: The server can push data to the client by using these methods, but no value will be returned.
Simply put, the API is a simple RPC mechanism supporting multiple protocols, namely XML and JSON (other options exist for pure Java clients). This section details some sample requests that can be used as a template for all server requests. For the purposes of this document JSON clients are the primary audience.
All server requests, regardless of format, have an interface type (server or client), a module, and a method. The module and interface are concatenated in a form dictated by Java inner class naming, e.g. XConnectModule$Server
. A method name is the method of the interface you wish to invoke, and arguments to a method is an array of arbitrary JSON values, with certain conventions depending on whether they are simple JSON values or objects expected to be deserialized to real Java types once they reach the server.
The following headers are required with every request:
application/json
for JSON clients and application/xml
for XML clients.The server often expects complex argument types when methods are invoked. For example, the login()
method of the XConnectModule$Server
class expects an XLoginCredentialsInfo
argument. How this is encoded depends on transport:
{"_class":"XLoginCredentialsInfo","UserName":"user name","UserPassword":"password"}
With few exceptions all requests are structured exactly the same way. The following is a template for how all methods are structured, whether the interface is Server or Client:
{"ModuleName":"Module$InterfaceType", "MethodName": "MethodName", "Arguments":[]}
Responses are always returned using the following structure:
{"returnValue":{"_class":"XLoginInfo",....},"returnStatus":"success"}
In the case where a method does not have a return value (i.e. void
) only returnStatus
is in the return object.
Login provides a good starting point because it demonstrates one of the more complex API calls, as well as being required to be called if you want to do anything of note. It requires an argument in the request and it returns a value in the response.
{"ModuleName":"XConnectModule$Server","MethodName":"login","Arguments":[{"_class":"XLoginCredentialsInfo","UserName":"user name","UserPassword":"password"}]}
{"returnValue":{"_class":"XLoginInfo",....},"returnStatus":"success"}
|
Oracle® On Track Communication SDK Documentation Release 1(1.0) E20955-01 |
|||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |