Introduction
In this tutorial we will connect a Web Task manager program to SAlly. We assume there is no task manager already integrated with Sally whose communication protocol we could reuse so will create one on our own. We will then use the JavaScript API to connect the task manager with SAlly. Here is a summary of the thing that we will do as part of this tutorial
General Workflow
First we need to come up with a unique identifier (called interfaceName
) for the communication protocol. For the sake of this tutorial we set ``interfaceName=tutorial-example```. This means that, when a client connects to SAlly and specifies "tutorial-example" as part of the "interfaces" field of "registerdocument" message, SAlly will know that it communicates using XML messages defined in the schema of our current project. For example, a client registering to SAlly using the following message
<registerdocument xmlns="http://kwarc.info/sally/comm/core">
<documentqueue>editor_tools_531</documentqueue>
<environmentid>123456</environmentid>
<interfaces>tutorial-example</interfaces>
<interfaces>text</interfaces>
</registerdocument>
communicates messages defined in communication protocols having interfaceName=tutorial-example (our project) and interfaceName=text (http://gl.kwarc.info/sally4/comm-text).
Creating Communication project
mvn -o archetype:generate -DarchetypeGroupId=info.kwarc.sally4.comm -DarchetypeArtifactId=comm-archetype -DarchetypeVersion=0.0.7 -Dversion=0.0.7 -DgroupId=info.kwarc.sally4.comm -DartifactId=comm-tutorial-example -DinterfaceName=tutorial-example
This will create a project called comm-tutorial-example. This project has a very simple structure, namely
├── pom.xml
└── src
└── main
└── resources
└── tutorial-example.xsd
The only thing left to do is to add to the "tutorial-example.xsd" file, the XML description of the messages we want to exchange.