ServiceClient client = new ServiceClient(context, null);
client.getOptions().setTo(new EndpointReference(toAddress));
client.getOptions().setAction("Event");
ByteArrayInputStream in = new ByteArrayInputStream(messageAsStr.getBytes());
client.sendReceive(new StAXOMBuilder(in).getDocumentElement());
} catch (AxisFault e) {
throw new EventException("Error sending a message from java script",e);
} catch (XMLStreamException e) {
throw new EventException("Error sending a message from java script", e);
}