REQUIREMENT client.script |
Type | NEW |
Priority | MEDIUM |
Status | CLOSED |
Topic | Invocations to the xmlBlaster server can be done with an xml script. | ||||||||||||||||||||
Des cription |
All invocations available to communicate to xmlBlaster can be done by submitting an
xml document (which we also call a script). The syntax for the xml script has been
designed with a particular emphasis on simplicity and flexibility. The script works with three streams:
The syntax of the request:
A request starts with an xmlBlaster tag having an optional id attribute
used to correlate a response to a request. Inside this root tag the following tags are
recognized:
The syntax of the response: A response starts with an xmlBlasterResponse tag having an optional id attribute used to correlate a response to a request (the same id as it was in the request). Inside this root tag the subtags are exactly the same as for the request. Every such subtag as childs corresponding to the litteral representation of the return object of the corresponding method invocation. For example a publish will have a child corresponding to the PublishReturnQos.toXml() method. Variable replacement
Variables with To switch this feature on you need to add following flags to the beginning of your script <!-- replace e.g. ${ICAO} with command line setting '-ICAO EDDI' --> <replaceQosTokens/> <replaceKeyTokens/> <replaceContentTokens/> <replaceTokens/> Setting configuration propertiesAt the beginning of the script you can set configuration properties,
similar you would do it from <xmlBlaster> <property name="queue/connection/defaultPlugin">RAM,1.0</property> <connect/> ... |
||||||||||||||||||||
Example any |
The following is a simple session which can be invoked the as: java javaclients.script.XmlScript \ -requestFile simpleSession.xml \ -responseFile out.xmlThe simpleSession.xml in this case would contain what follows. The answers coming from xmlBlaster are collected in out.xml. If you want the output on the standard output stream omit to specify a responseFile. If you want to read from the standard input stream omit the requestFile. <xmlBlaster> <!-- note that if you omit the qos it will take an empty one (default) --> <replaceTokens /> <property name="waitMillis">1000</property> <property name="queue/connection/defaultPlugin">RAM,1.0</property> <echo message="Starting now ${waitMillis} ..."/> <echo message="Starting now ..."/> <connect/> <input message="Hit a key to continue # "/> <subscribe><key oid="test"></key><qos/></subscribe> <wait delay="${waitMillis}" /> <publish> <key oid="test"><airport name="london" /></key> <content>This is a simple script test</content> <qos/> </publish> <publishArr> <message> <key oid="test"></key> <content>This is a simple script test 1</content> <qos/> </message> </publishArr> <get><key oid="test" /></get> <input message="Hit a key to continue # "/> <subscribe> <key queryType="XPATH">//airport</key> </subscribe> <wait delay="${waitMillis}" /> <unSubscribe><key oid="test"/></unSubscribe> <erase><key oid="test"></key><qos/></erase> <wait delay="${waitMillis}" /> <disconnect /> </xmlBlaster> Waiting could as well look like this: <wait delay="6000" updates="4" message="Waiting for messages ..."/> And as the response to the upper request: <xmlBlasterResponse> <!-- _____________________ connect ________________________________ --> <connect> <qos> <securityService type="htpasswd" version="1.0"> <user>michele</user> <passwd>secret</passwd> </securityService> <session name='/node/xmlBlaster_127_0_0_2_3412/client/michele/-3' timeout='86400000' maxSessions='10' clearSessions='false' reconnectSameClientOnly='false' sessionId='IIOP:0111332A414'/> <queue relating='connection'> <address type='IOR'> </address> </queue> <queue relating='subject'/> <queue relating='callback' maxEntries='1000' maxEntriesCache='1000'> <callback type='IOR' dispatchPlugin='undef'> IOR:000000000000004049444C3A6F72672E786D6C426C6173746.......... </callback> </queue> <serverRef type='IOR'> IOR:000000000000003749444C3A6F72672E786D6C426C617374657........ </serverRef> </qos> </connect> <!-- _____________________ subscribe ______________________________ --> <subscribe> <qos> <subscribe id='__subId:xmlBlaster_127_0_0_2_3412-5'/> <isSubscribe/> </qos> </subscribe> <!-- -- -- -- -- -- -- -- -- update -- -- -- -- -- -- -- -- -- -- -- --> <update> <sessionId>unknown</sessionId> <key oid='test'> <airport name='london'></airport> </key> <content><![CDATA [This is a simple script test]]></content> <qos> <sender>/node/xmlBlaster_127_0_0_2_3412/client/michele/-3</sender> <subscribe id='__subId:xmlBlaster_127_0_0_2_3412-5'/> <rcvTimestamp nanos='1075409585202000001'/> <queue index='0' size='1'/> <isUpdate/> </qos> </update> <!-- ________________________ publish ________________________________ --> <publish> <qos> <key oid='test'/> <rcvTimestamp nanos='1075409585202000001'/> <isPublish/> </qos> </publish> <!-- -- -- -- -- -- -- -- -- -- update -- -- -- -- -- -- -- -- -- -- -- --> <update> <sessionId>unknown</sessionId> <key oid='test'/> <content><![CDATA [This is a simple script test 1]]></content> <qos> <sender>/node/xmlBlaster_127_0_0_2_3412/client/michele/-3</sender> <subscribe id='__subId:xmlBlaster_127_0_0_2_3412-5'/> <rcvTimestamp nanos='1075409585342000001'/> <queue index='0' size='1'/> <isUpdate/> </qos> </update> <!-- -- -- -- -- -- -- -- -- -- update -- -- -- -- -- -- -- -- -- -- -- --> <update> <sessionId>unknown</sessionId> <key oid='test'/> <content><![CDATA [This is a simple script test 2]]></content> <qos> <sender>/node/xmlBlaster_127_0_0_2_3412/client/michele/-3</sender> <subscribe id='__subId:xmlBlaster_127_0_0_2_3412-5'/> <rcvTimestamp nanos='1075409585348000001'/> <queue index='0' size='1'/> <isUpdate/> </qos> </update> <!-- -- -- -- -- -- -- -- -- -- update -- -- -- -- -- -- -- -- -- -- -- --> <update> <sessionId>unknown</sessionId> <key oid='test'/> <content><![CDATA [This is a simple script test 3]]></content> <qos> <sender>/node/xmlBlaster_127_0_0_2_3412/client/michele/-3</sender> <subscribe id='__subId:xmlBlaster_127_0_0_2_3412-5'/> <rcvTimestamp nanos='1075409585400000001'/> <queue index='0' size='1'/> <isUpdate/> </qos> </update> <!-- -- -- -- -- -- -- -- -- -- update -- -- -- -- -- -- -- -- -- -- -- --> <update> <sessionId>unknown</sessionId> <key oid='test'/> <!-- Same attributes as clientProperty are supported: --> <content encoding="base64" charset="windows-1252">SGVsbG9Xb3JsZA==</content> <qos> <sender>/node/xmlBlaster_127_0_0_2_3412/client/michele/-3</sender> <subscribe id='__subId:xmlBlaster_127_0_0_2_3412-5'/> <rcvTimestamp nanos='1075409585412000001'/> <queue index='0' size='1'/> <isUpdate/> </qos> </update> <!-- ________________________ publishArr _____________________________ --> <publishArr> <message> <qos> <key oid='test'/> <rcvTimestamp nanos='1075409585342000001'/> <isPublish/> </qos> </message> <message> <qos> <key oid='test'/> <rcvTimestamp nanos='1075409585348000001'/> <isPublish/> </qos> </message> <message> <qos> <key oid='test'/> <rcvTimestamp nanos='1075409585400000001'/> <isPublish/> </qos> </message> <message> <qos> <key oid='test'/> <rcvTimestamp nanos='1075409585412000001'/> <isPublish/> </qos> </message> </publishArr> <!-- ________________________ get ____________________________________ --> <get> <message> <key oid='test'/> <content><![CDATA[This is a simple script test 4]]></content> <qos> <sender>/node/xmlBlaster_127_0_0_2_3412/client/michele/-3</sender> <rcvTimestamp nanos='1075409585412000001'/> <route> <node id='xmlBlaster_127_0_0_2_3412' stratum='0' timestamp='1075409585412000001' dirtyRead='false'/> </route> </qos> </message> </get> <!-- -- -- -- -- -- -- -- -- -- update -- -- -- -- -- -- -- -- -- -- -- --> <update> <sessionId>unknown</sessionId> <key oid='test'/> <content><![CDATA [This is a simple script test 4]]></content> <qos> <sender>/node/xmlBlaster_127_0_0_2_3412/client/michele/-3</sender> <subscribe id='__subId:xmlBlaster_127_0_0_2_3412-XPATH6'/> <rcvTimestamp nanos='1075409585412000001'/> <queue index='0' size='1'/> <route> <node id='xmlBlaster_127_0_0_2_3412' stratum='0' timestamp='1075409585412000001' dirtyRead='false'/> </route> <isUpdate/> </qos> </update> <!-- ________________________ subscribe ______________________________ --> <subscribe> <qos> <subscribe id='__subId:xmlBlaster_127_0_0_2_3412-XPATH6'/> <isSubscribe/> </qos> </subscribe> <!-- ________________________ unSubscribe ____________________________ --> <unSubscribe> <qos> <subscribe id='__subId:xmlBlaster_127_0_0_2_3412-5'/> <isUnSubscribe/> </qos> <qos> <subscribe id='__subId:xmlBlaster_127_0_0_2_3412-XPATH6:7'/> <isUnSubscribe/> </qos> </unSubscribe> <!-- ________________________ erase __________________________________ --> <erase> <qos> <key oid='test'/> <isErase/> </qos> </erase> <!-- ________________________ disconnect _____________________________ --> <disconnect>true</disconnect> </xmlBlasterResponse> |
||||||||||||||||||||
Example any |
Exception example<xmlBlasterResponse> <exception errorCode='user.illegalArgument'> <class>org.xmlBlaster.util.XmlBlasterException</class> <isServerSide>true</isServerSide> <node>heron</node> <location>Authenticate-/node/heron.InvalidClientName</location> <lang>en</lang> <message>#1.0.7 Your given loginName is null or shorter 2 chars</message> <versionInfo>version=1.0.7,os.name=Linux,os.version=2.6.13</versionInfo> <timestamp>2005-11-11 09:30:30.69</timestamp> <stackTrace>errorCode=user.illegalArgument message=#1.0.7 Your given loginName is null or shorter 2 chars, loginName rejected at Authenticate.connect(Authenticate.java:352) at AuthServerImpl.connectIntern(AuthServerImpl.java:260) at AuthServerImpl.connect(AuthServerImpl.java:232) at RequestProcessor.invokeOperation(RequestProcessor.java:281) at RequestProcessor.process(RequestProcessor.java:576) at RequestProcessor.run(RequestProcessor.java:718)></stackTrace> <embeddedMessage></embeddedMessage> </exception> </xmlBlasterResponse> |
||||||||||||||||||||
Configure |
You can control the extend of the generated XML markup (the returned QoS) by setting following configuration parameters.
NOTE: Configuration parameters are specified on command line (-someValue 17) or in the
xmlBlaster.properties file (someValue=17). See requirement "util.property" for details. |
||||||||||||||||||||
See API | org.xmlBlaster.client.script.XmlScriptInterpreter | ||||||||||||||||||||
See API | The test client XmlScriptClient | ||||||||||||||||||||
See REQ | engine.qos.clientProperty | ||||||||||||||||||||
See REQ | interface | ||||||||||||||||||||
See TEST | org.xmlBlaster.test.classtest.XmlScriptInterpreterTest |
This page is generated from the requirement XML file xmlBlaster/doc/requirements/client.script.xml