[This local archive copy is from the official and canonical URL, http://newton.thinlink.com/xp/; please refer to the canonical source document if possible.]


  com.thinlink.xp

An Extensible Protocol Implementation in Java

Extensible Protocol (XP) is a bidirectional protocol on which XML documents are exchanged between two endpoints.

The com.thinlink.xp package implements XP draft 00 using stream sockets and the IBM xml4j processor.  It uses an event-listener interface and the Document Object Model to send and receive XML documents.

Author: Tom Harding
tomh@thinlink.com

Download

com.thinlink.xp is distributed under the terms of the GNU General Public License.
Modifications to the IBM xml4j parser are distributed in accordance with IBM's xml4j distribution license agreement.
Download com.thinlink.xp Version 0.1.0 plus xml4j mods [219K]
Browse Documentation

What is XP good for?

XP will work best for applications that use relatively long-lasting, contextual conversations.  Because it provides a level of indirection from actual method invocations, I think it is suitable for use on the public Internet (if only people would open up those goshdarn firewalls <g>).

XP is extremely simple and lets you build outward from the wire, rather than inward from a complex software interface.  It provides only a transport for moving documents from one end to the other, and the response tagging necessary to allow interleaved responses and multiple responses to a single request.

With XP, literally everything that crosses the wire is XML.  There is no distinction of the representation of control information from that of data.  If you need to define an authentication procedure, use XML documents.  If you want to add error reporting, use XML documents.  If you want to use your existing document types as valid messages in your protocol, go right ahead.

XP might be used for generic frameworks, homegrown special-purpose protocols, or anything in between -- about the same range as XML itself.
 

Why would I need XP?

If you're thinking "why would I need XP, when I can use HTTP, browsers, style sheets, etc.?" then it's entirely possible that you don't need XP.
 

Why is com.thinlink.xp based on the IBM processor?

XP requires some subtle behavior from the underlying processor.  IBM's xml4j was relatively easy to adapt to this task because of its modular I/O architecture.  I would love to see other processors tested and/or modified to support XP as well.
 

How do I use com.thinlink.xp?

Running the Sample
To run the sample, you might type:

cd xp_0_1_0
java -classpath .;xp.jar;xp_xml4j.jar;/xml4j_2_0_3/xml4j.jar HelloEndpoint

General instructions
You will need to import these packages:
import java.net.*;
import org.w3c.dom.*;
import com.thinlink.xp.*;

import com.ibm.xml.parser.*; // TXDocument needed for now.  See docs.

Create an Endpoint.  For example:
endpoint Endpoint = new Endpoint();
endpoint.setSocket(new Socket("xp.acme.com", 1222));
Of course, the other side needs to be waiting to accept a connection, and also must be prepared to speak XP.  Start the Endpoint's XP processing like this:
endpoint.start();
To send a request (i.e. act like a client), you could do this...
endpoint.sendRequest(myDocument, null);

(To process responses, you would need to pass a DocumentListener.  See docs.)

To register DocumentListeners to process unsolicited requests (i.e. act like a server), call endpoint.addDocumentListener.

Platform testing

This package has been tested successfully with Java 1.1 on Windows 95/NT, OS/2, Linux, and OS/400, and with Java 2 on Windows NT.