1 using System;
2 using org.xmlBlaster.client.activex;
3
4 namespace demo
5 {
6 /// <summary>
7 /// Example how to access xmlBlaster using the ActiveX Bridge
8 /// to access the Java client library (Windows only)
9 /// </summary>
10 /// <remarks>
11 /// First you need to create and register the ActiveX Bridge
12 /// with the 'build' command below.
13 /// See: xmlBlaster\src\java\org\xmlBlaster\client\activex
14 /// See: build -DJRE_HOME=C:\PROGRA~1\Java\j2re1.5.0 -DJVM.target=1.4 activex
15 /// </remarks>
16 /// <author>
17 /// Marcel Ruff
18 /// </author>
19 class XmlBlasterCSharp
20 {
21 [STAThread]
22 static void Main(string[] args)
23 {
24 // See registry:
25 // regedit -> HKEY_CLASSES_ROOT
26 // -> CLSID
27 // -> D824B185-AE3C-11D6-ABF5-00B0D07B8581
28 // -> XmlScriptAccess Bean Control
29 // org.xmlBlaster.client.activex.XmlScriptAccess
30
31 XmlScriptAccess.XmlScriptAccessClass xmlBlaster;
32 xmlBlaster = new XmlScriptAccess.XmlScriptAccessClass();
33
34 string[] argArr = { "-protocol", "SOCKET" };
35 xmlBlaster.initArgs(argArr);
36
37 string request = "<xmlBlaster>" +
38 " <connect/>" +
39 " <wait delay='1000' />" +
40 " <publish>" +
41 " <key oid='test'><airport name='london' /></key>" +
42 " <content>This is a simple script test</content>" +
43 " <qos/>" +
44 " </publish>" +
45 "</xmlBlaster>";
46 string response = xmlBlaster.sendRequest(request);
47 Console.WriteLine("Got response from xmlBlaster: " + response);
48 }
49 }
50 }
syntax highlighted by Code2HTML, v. 0.9.1