XmlBlaster Logo



XmlBlaster Logo

Type NEW
Priority MEDIUM
Topic XmlBlaster provides full access from C#.


You have full access to XmlBlaster's interface from C#. Currently there are several approaches to choose from, starting from using the full XmlBlaster client capabilities (fail-over, client cache, ...) when using the ActiveX technologies up to complete access using the XML-RPC protocol but without advanced client features.

The following table gives an overview, we recommend to choose 1.

Approaches to access xmlBlaster from C#

Approach Description Pro Con Impl
1. Call external C library The C xmlBlaster client library can be imported to C# with [DllImport("xmlBlasterClientC.dll")], this uses the System.Runtime.InteropService.DllImport attribute for each external function being wrapped.
See our wrapper xmlBlaster/src/csharp/PInvokeCE.cs (xmlBlaster/src/csharp/NativeC.cs is deprecated)
and a demo client xmlBlaster/src/csharp/Hello.cs.
You need to compile the C client library (.dll or .so) with a call 'build c-lib' first (see requirement client.c.socket)
xmlBlaster/src/csharp/PInvokeCE.cs supports the Compact Framework .NET 2.x (CF2). More details are described in requirement requirement client.c.windowsCE.
Mono/Linux 1.2 ships with complete C# 1.0 and C# 2.0 compilers, called mcs and gmcs respectively. To compile PInvokeCE.cs with mono/Linux please use the 'gmcs' compiler instead of 'mcs'.
Todo: Make the same wrapper for our C++ client library
Good performance, all functionality of the C library (like compression and tunneling callbacks) is available, a tested code base PInvokeCE.cs was developed under Mono/Linux and Windows XP and Windows CE CF2, using the code as an assembly is an open task. The C library '.dll' or '.so' must be available, e.g. compiled and installed for a Linux/Windows/Windows-CE environment. No client side queuing (our C sqlite based persistent queue is currently integrated into C++ only). For compilation and usage details see PInvokeCE.cs yes
2. XmlRpc Using XML-RPC is described in this document. small framework no compression, no tunneled callback yes
3. ActiveX bridge Bridge to Java client library which is available as COM object, see client.activex framework Complete functionality of the java client library is available, like compression, tunneling callbacks, SSL, client side queueing There must be a java runtime environment installed (JRE 1.4 or higher), high configuration effort yes
4. SOCKET Implement xmlBlaster access with the native protocol.socket. This means that we have to implement in C# all needed client side functionality again, like compression, tunneling, client side queuing. Everything is natively implemented Coding effort, maintenance, tests no
5. IKVM call Java from C# Not yet tested, see IKVM homepage
  • A Java Virtual Machine implemented in .NET
  • A .NET implementation of the Java class libraries
  • Tools that enable Java and .NET interoperability
not known not known no
6. Visual J# 2005 Providing our java client library to the .net framework with Visual J#. Afaik J# support JDK 1.1.4 only, so we can't compile our java client library to .net binaries?
See this interop discussion: http://msdn.microsoft.com/vstudio/java/interop/default.aspx
not known not known no


For Windows users only, you can use the original xmlBlaster Java Client library by hosting it with the free ActiveX bridge from SUN (Java JDK 1.5).
To see detail about using the ActiveX bridge from SUN (Java JDK 1.5) to host the XmlBlaster Client library, have a look at the client.activex requirement.


The second way use XML-RPC protocol to access XmlBlaster. This page will explain this technology. You will find the demonstration in the directory xmlBlaster/demo/csharp/xmlrpc.

All XmlBlaster's interface are supported:

Items with an asterix are fully functionnals but not implemented in the demo (for the moment).

The demo

The demonstration was done with Microsoft Visual Studio .NET 2003, but it should works with CSharpDevelop IDE (just create a new projet, reference xml-rpc library and System.Remoting and include the *.cs files). Problably it will or not need some changes to run with mono.

The Microsoft .Net Framework does not include the xml-rpc protocol, so we have to use a external library (assembly). I've choose xml-rpc.net.0.9.2 from http://www.xml-rpc.net/ written by Charles Cook. It seems to be nice and it implements Client and Server side of the protocol.

The demo consists in a little drawing application.
You can draw in the white panel of the form, your drawings will be send to each other drawing demo connected to the XmlBlaster server.

To run the demo, click on the exe file two times.
In each instance, choose a different username then click connect.
After connected you can start drawing on one instance and see your drawings on the second instance.
Of course, you can start instances on differents computers, just think to adapt the server_url to be the address of the computer running XmlBlaster server.

DrawingDemo screenshot1


Start XmlBlaster server

   > set XMLBLASTER_HOME=D:\xmlBlaster_REL_1_0_7\xmlBlaster
   > java -jar %XMLBLASTER_HOME%/lib/xmlBlaster.jar -plugin/xmlrpc/port 8089 -plugin/xmlrpc/hostname localhost

Start 2 demo applications by clicking on xmlBlaster/demo/csharp/xmlrpc/bin/CSharpDrawingDemo.exe.
On the first instance of the application, click button connect.
On the second one change the username to 'guest2' then click button connect.
In one application instance, draw some forms (line, rectangle...), and have a look to other instance. Normally you can see your drawings on each.


Here will come some peace of code.

Configure Client Side
  • Got a xmlrpc library (provided with the demo). The demo using the xml-rpc.net.0.9.2 from http://www.xml-rpc.net/.
Server Side
  • Be sure to have the xmlrpc plugin activated (should be already in default distribution).
  • To activate the debug mode of the xmlrpc plugin, add '-plugin/xmlrpc/debug true' in the command line for starting XmlBlaster

NOTE: Configuration parameters are specified on command line (-someValue 17) or in the xmlBlaster.properties file (someValue=17). See requirement "util.property" for details.
Columns named Impl tells you if the feature is implemented.
Columns named Hot tells you if the configuration is changeable in hot operation.

  • Finish this requirement and rewrite bad english sentences (all my excuses, cyrille).
  • make a demo that demonstrate all XmlBlaster interface methods implementation in a simple way (without any other functionnality).
  • Make the CSharpDevelop project files.
  • Make the demo compiling and running with Mono.
See http://www.xmlBlaster.org/xmlBlaster/demo/csharp/xmlrpc/README
See REQ interface
See REQ client.c.windowsCE
See REQ protocol.xmlrpc

This page is generated from the requirement XML file xmlBlaster/doc/requirements/client.csharp.xml

Back to overview