1). Pass the event payload inXML.
When using Event.createEventFromXML() to create events, the second argument XML String should adhere to the XSD schema corresponding to the event definition.
The second argument is used as shown below.
Event.createEventFromXML("<ONTOLOGY_PATH_OF_THE_EVENT>", "<EventName><payload>"+xmlpayload+"</payload></EventName>");
Example :
//Creating a orderline event from the XML argument as payload.
Events.OrderlineEvent Orderline = Event.createEventFromXML("/Events/OrderlineEvent", "<OrderlineEvent><payload>" + xmlpayload + "</payload></OrderlineEvent>");
Note : The XML header tag present in String XML might cause parsing issues. In this case, remove the XML version from the input XML string
Part to remove :<?xml version="1.0" encoding="UTF-8"?>
2). Pass the event properties and payload XML.
Creating an event by passing the second argument with the event properties XML as shown below. Event.createEventFromXML("<ONTOLOGY_PATH_OF_THE_EVENT>", "<EventName><property1>123</property1><property2>456</property2><property3>789</property3></EventName>");
Example: Events.TestEve TestProperty = Event.createEventFromXML("/Events/TestEve", "<TestEve><lineId>4</lineId><productId>abc</productId><qty>4</qty></TestEve>");