Hi All, I was trying to run the example of custom Action but it is not running .
I am pasting the codde snippet of all the files for custom action , Please let me know where I am wrong : 1. StopWatch.xml <scxml xmlns="http://www.w3.org/2005/07/scxml" *xmlns:my=" http://my.custom-actions.domain/CUSTOM1"* version="1.0" initialstate="reset"> <state id="reset"> <onentry> *<my:hello name="saurabh" />* <!-- foo:bar also maps to Hello action --> <!--foo:bar name="custom action" /--> </onentry> </state> <state id="running"> <transition event="watch.split" target="paused"/> <transition event="watch.stop" target="stopped"/> </state> <state id="paused"> <transition event="watch.unsplit" target="running"/> <transition event="watch.stop" target="stopped"/> </state> <state id="stopped"> <transition event="watch.reset" target="reset"/> </state> </scxml> *2. Code Snippet of my APP Starting the State machine :* protected void doInvite(SipServletRequest request) throws ServletException, IOException { log(" $$$ ############################ SimpleProxyServlet: Got request:\n" + request+" TO::"+request.getTo()); log (" New log To::"+request.getTo().toString()); HashMap aMap=new HashMap() ; aMap.put("SipMessage",request.toString() ); SimpleContext sc=new SimpleContext(aMap); // (1) Create a list of custom actions, add as many as are needed *List customActions = new ArrayList(); CustomAction ca = new CustomAction("http://my.custom-actions.domain/CUSTOM", "hello", Hello.class); customActions.add(ca); // (2) Parse the SCXML document containing the custom action(s) SCXML scxml = null; try { // try {URL url=new URL (StopClock.class.getClassLoader().getResource("PocAS/stopwatch.xml")); scxml = SCXMLParser.parse(StopClock.class.getClassLoader().getResource("PocAS/stopwatch.xml"), new SimpleErrorHandler(), customActions); // Also see other methods in SCXMLParser API // "url" points to SCXML document // "errorHandler" is SAX ErrorHandler } catch (SAXException ex) { Logger.getLogger(MainPocAS.class.getName()).log(Level.SEVERE, null, ex); } catch (ModelException ex) { Logger.getLogger(MainPocAS.class.getName()).log(Level.SEVERE, null, ex); } // Also see other methods in SCXMLParser API // "url" points to SCXML document // "errorHandler" is SAX ErrorHandler StopClock clock=new StopClock(scxml);* clock.getEngine().setRootContext(sc); // if(request.getTo().toString().equals("Alice1")) clock.fireEvent(StopClock.EVENT_RESET); 3 . Java File of Action ( Hello from commons-scxml - copypasting the imp snippet ) public class Hello extends Action implements ExternalContent { /** Serial version UID. */ private static final long serialVersionUID = 1L; /** This is who we say hello to. */ private String name; /** We count callbacks to execute() as part of the test suite. */ public static int callbacks = 0; /** Public constructor is needed for the I in SCXML IO. */ public Hello() { super(); System.out.println("Hello: Got in Hello constructor..."); } /** * Get the name. * * @return Returns the name. */ public String getName() { System.out.println("Hello: getName"); return name; } /** * Set the name. * * @param name The name to set. */ public void setName(String name) { this.name = name; System.out.println("Hello: setName"); } /** * @inheritDoc */ public void execute(final EventDispatcher evtDispatcher, final ErrorReporter errRep, final SCInstance scInstance, final Log appLog, final Collection derivedEvents) throws ModelException, SCXMLExpressionException { System.out.println("Hello: execute"); if (appLog.isInfoEnabled()) { appLog.info("Hello " + name); } // For derived events payload testing TriggerEvent event = new TriggerEvent("helloevent", TriggerEvent.SIGNAL_EVENT, name); derivedEvents.add(event); callbacks++; } public List getExternalNodes() { throw new UnsupportedOperationException("Not supported yet."); } } Please let me know what I am doing wrong . Thanks & Regards Saurabh -- "Successful people make more mistakes because they do more " Thanks Saurabh Agarwal