Products | Versions |
---|---|
TIBCO BusinessEvents Enterprise Edition | - |
Not Applicable | - |
Resolution:
The only different between execute and executeWithEvent is the input. The executeWithEvent require a event as the input. The xml of that event looks like below:
<ns0:NewEvent xmlns:ns0="www.tibco.com/be/ontology/NewEvent" Id="2"><payload><ns0:root><AAA><CCC>Input for CCC</CCC></AAA><BBB><DDD>Input for DDD</DDD></BBB></ns0:root></payload></ns0:NewEvent>
The sub-elements under payload are the schema which you specified in the payload tab of that event. I think the reason why you didn’t get the correct the result is that you didn’t provide the correct namespace and prefix. You can use xpath ‘/*’ to get the all elements in that event. And then you can get the correct namespace and prefix.
For example, please check below code.
String xpath = "/*";
NewEvent event = Event.createEvent(…);
String prefixes = "ns0=www.tibco.com/be/ontology/NewEvent";
String result = XPath.executeWithEvent(xpath, event, prefixes);
System.debugOut("result = " + result);
If you want to get the root element, you need to use String xpath = "//ns0:root";. Please note that the root element of that event is the ns0:Event, not the ns0:root. So please make sure you use the correct xpath and namespace.