Open MTOM Server |
by |
Remsy Schmilinsky Martinez |
Open MTOM Server is simply a file transfer web service that includes a server and client API written in C
and C++.
The file transmission method relies on SOAP 1.2 with MTOM attachments, powered by gSoap web service toolkit. Feel free to browse the source code.
On the client side, developers use the provided API for any application invoking the functionality from the server. The data being transmitted between client and servers is just a file or many files, so developers are resposible for customizing what the server does with these files through the implementation of plugins, or server extensions.
You are encouraged to download it and experiment with it, your feedback or contribution is greatly appreciated.
Where to use.
Developers can build server and clients for any particular purpose, such us, an XML validation service, a file
conversion service, xml transaction processing, file transfer, trasmitting or receiving high volume
of data at a given time, etc. The only constraint is that data is transmitted as files.
Building and testing.
You can build it from source Linux, using C++ GNU compiler and make. Follow these steps:
1.- Install the POCO libraries. Download and build the
C++ Portable Components.
If successful, edit you bash profile (i.e. ~/.bashrc) and modify LD_LIBRARY_PATH environment variable to point
to the location of the POCO library, for example:
export LD_LIBRARY_PATH=~/poco-1.3.2/lib/Linux/i686
2.- Get the source.
Run this command to obtain the source from the subversion repository:
svn co https://mtomserver.svn.sourceforge.net/svnroot/mtomserver mtomserver
3.- Compile client and server. Go to mtomserver directory and type make. This will compile the client API, the server and all the examples.
4.- Testing the server. Go to mtomserver/server
directory and run:
./server config.xml
The server uses startup parameters that you may adapt to your needs. Read further for an explanation
of these parameters.
The default server plugin simply reads an XML describing files generated and sent by remote clients, then
it replies back with an XML acknowledment and the same files sent form the client(for demonstrating
multiple files per request / response).
5.- Testing the client. Open another terminal and
go to mtomserver/client/bin directory, then run:
./echoXML localhost:8085 1
This is a client example that sends 2 files. The first is an XML describing the number of files specified in the
last argument. Here, we are generating 1 file, so the server will send back an XML acknowledment plus
the file you've sent. The files the server sends back are named as UUID keys.
To test multiple calls to the server, run:
./echoXMLThreaded localhost:8085 1
This will perform mutiple calls to the server. You may run this example in different terminals to see
how the server handles multithreading.
Server configuration.
The server reads configuration parameters from an XML file upon starting up. These parameters determine
its behaviour.
You can use file mtomserver/server/config.xml as an example for your own settings.
Here is an explanation of each setting:
port
Port number receiving remote client requests, default is 8085.
pluginLib
Dynamic library containing plugin classes.
pluginClass
Specific plugin to be used by the server/
timeout
Maximum time for server idle state in seconds.
datapath
Directory where incoming files are stored (client requests), example, "data", "data/path", etc.
deleteInput
Whether to leave or delete incoming files. Set to true or false.
deleteOutput
Whether to leave or delete output files. Set to true or false.
keepAlive
Enable keep-alive socket connections. Set to true or false.
poolSize
Number of threads to create upon start up (thread pool).
maxFileSize
Maximum file size in bytes that server can accept. If a client sends a request with a file or
multiple files, and the size of one of the files exceeds the maximum allowed, then
the server throws a soap error and the whole request is cancelled.
maxNumberFiles
Maximum number of files server can accept simultaneously. If a client sends a request with multiple
files, and the number of such files exceeds the maximum allowed, then the server throws a soap error
and the whole request is cancelled. On linux, it is possible for the server to process up to 60 files
per client request (this behaviour is specific to the operating system).
logPattern
Custom formatting of log messages based on format patterns (refer to the POCO documentation for
available options).
logFile
Name of the file containing all logging information.
logRotation
Rotation strategy (refer to the POCO documentation for available options).
logLevel
Possible values: fatal, critical, error, warning, notice, information, debug, trace.
Only messages with a priority equal to or higher than the specified level are passed on.
For example, if the level of a logger is set to error, only messages with
priority error, critical and fatal will propagate.