Invoke a WebService from ActionHandler
dadajboss Jan 10, 2008 10:58 AMHi all.
I'm trying to invoke a web service from my jBoss/jBPM process.
As Ronald suggests in this post:
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=70723
I write an actionhandler which invokes the webservice and then I associate it on a node-enter event of a node.
But when I run the process from jBoss-jBpm console I get an exception
description The server encountered an internal error () that prevented it from fulfilling this request. exception javax.servlet.ServletException: Servlet execution threw an exception org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) root cause java.lang.NoClassDefFoundError: org/apache/axis/client/Service com.Process_3.WebServiceAction.execute(WebServiceAction.java:22) org.jbpm.graph.def.Action.execute(Action.java:122) org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:264) org.jbpm.graph.def.GraphElement.executeActions(GraphElement.java:220) org.jbpm.graph.def.GraphElement.fireAndPropagateEvent(GraphElement.java:190) org.jbpm.graph.def.GraphElement.fireEvent(GraphElement.java:174) org.jbpm.graph.def.Node.enter(Node.java:303) org.jbpm.graph.def.Node$$FastClassByCGLIB$$d187eeda.invoke(<generated>) net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149) org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:163) org.jbpm.graph.def.Node$$EnhancerByCGLIB$$ad2fc36c.enter(<generated>) org.jbpm.graph.def.Transition.take(Transition.java:151) org.jbpm.graph.def.Node.leave(Node.java:394) org.jbpm.graph.node.TaskNode.leave(TaskNode.java:209) org.jbpm.graph.node.TaskNode$$FastClassByCGLIB$$923668a4.invoke(<generated>) net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149) org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:163) org.jbpm.graph.node.TaskNode$$EnhancerByCGLIB$$e933732a.leave(<generated>) org.jbpm.graph.exe.Token.signal(Token.java:195) org.jbpm.graph.exe.Token.signal(Token.java:140) org.jbpm.graph.exe.Token$$FastClassByCGLIB$$74df1c6e.invoke(<generated>) net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149) org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:163) org.jbpm.graph.exe.Token$$EnhancerByCGLIB$$dc8930e8.signal(<generated>) org.jbpm.taskmgmt.exe.TaskInstance.end(TaskInstance.java:485) org.jbpm.taskmgmt.exe.TaskInstance.end(TaskInstance.java:399) org.jbpm.jsf.core.action.CompleteTaskActionListener.handleAction(CompleteTaskActionListener.java:47) org.jbpm.jsf.core.impl.JbpmActionListenerWrapper.processAction(JbpmActionListenerWrapper.java:82) javax.faces.event.ActionEvent.processListener(ActionEvent.java:77) javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:758) javax.faces.component.UICommand.broadcast(UICommand.java:368) org.jbpm.jsf.taskform.ui.UITaskFormButtonBase.broadcast(UITaskFormButtonBase.java:56) javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:448) javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:752) com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97) com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:248) com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117) javax.faces.webapp.FacesServlet.service(FacesServlet.java:244) org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
This is the ActionHandler code:
package com.Process_3; import org.jbpm.graph.def.ActionHandler; import org.jbpm.graph.exe.ExecutionContext; import org.apache.axis.client.Call; import org.apache.axis.client.Service; import org.apache.axis.encoding.XMLType; import javax.xml.rpc.ParameterMode; public class WebServiceAction implements ActionHandler { private static final long serialVersionUID = 1L; public void execute(ExecutionContext executionContext) throws Exception { // Make the call String method = new String("Get_CodFisFromLocalita"); String endpoint = "http://www.nexusonline.it:8088/4DWSDL"; String city = (String) ("Milano"); Service service = new Service(); Call call = (Call) service.createCall(); call.setTargetEndpointAddress(new java.net.URL(endpoint)); call.setOperationName( method ); call.addParameter(city, XMLType.XSD_STRING, ParameterMode.IN); call.setReturnType(XMLType.XSD_STRING); String ret = (String) call.invoke( new Object[] { city } ); executionContext.getContextInstance().createVariable("sigla", ret); System.out.println("Result: " + ret); } }
Note:
I deploy the process by mean jBPD Eclipse plugin.
Any help will be appreciated.
Thank you!