Here's a simple example that sends a query to another application and then displays its reply. Both the query and the reply are stored in the first argument of the message.
(defun tooltalk-random-query-handler (msg)
(let ((state (get-tooltalk-message-attribute msg 'state)))
(cond
((eq state 'TT_HANDLED)
(message (get-tooltalk-message-attribute msg arg_val 0)))
((memq state '(TT_FAILED TT_REJECTED))
(message "Random query turns up nothing")))))
(defvar random-query-message
'( class TT_REQUEST
scope TT_SESSION
address TT_PROCEDURE
op "random-query"
args '((TT_INOUT "?" "string"))
callback tooltalk-random-query-handler))
(let ((m (make-tooltalk-message random-query-message)))
(send-tooltalk-message m))