5 Replies Latest reply on Jul 8, 2006 10:24 AM by bertrand.njiipwo

    Web Service invocation inside a BPEL-Process failed.

      Hello @all,

      i have written a BPEL-process(Invoker-process) which call the HelloWolrd-WS.
      The deploying steps (similar like deploy the hello-process) where OK. I create a Junit-Test to test my application and some thing is wrong with the port.

      I have first succefully deploy the hello-process (from the jbpm.bpel-examples) wich is avialable as web service on the Jbosss-AS. Please correct me if this way trying to make the Hello-process as web service avialable is OK.

      Running the test case for the invokerprocess has some isues:
      the system can instanciate the invoker-process but calling the hello process failed although it's avialable as service.

      What i'm expecting hier when i call the invoker-process is to see an instanciation of this and the helloWorld process so that i can see the execution of the invoker- HelloWorld process take respectively 50 ms and 30 ms (for example).

      To my configuration:
      JBoss AS-4.0.3-SP1, jbpm-3.0.3, jbpm-bpel-1.0-alpha4, mysql

      The Error:

      Buildfile: C:\OrdnerHyrarchie\MyCourses\Diplomarbeit\KOM\jBPM\Engine\jbpm-bpel-1.0-alpha4\doc\examples\invoker\build.xml
      compile-test:
      run-test:
       [junit] Testsuite: org.jbpm.bpel.tutorial.invoker.InvokerTest
       [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 63,662 sec
       [junit] ------------- Standard Output ---------------
       [junit] 12:01:41,305 DEBUG SecurityAssociation : Using ThreadLocal: false
       [junit] 12:02:42,023 ERROR PortProxy : Port error
       [junit] java.net.SocketTimeoutException: Read timed out
       [junit] at java.net.SocketInputStream.socketRead0(Native Method)
       [junit] at java.net.SocketInputStream.read(SocketInputStream.java:129)
       [junit] at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
       [junit] at java.io.BufferedInputStream.read(BufferedInputStream.java:235)
       [junit] at org.jboss.axis.transport.http.HTTPSender.readHeadersFromSocket(HTTPSender.java:571)
       [junit] at org.jboss.axis.transport.http.HTTPSender.invoke(HTTPSender.java:135)
       [junit] at org.jboss.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:73)
       [junit] at org.jboss.axis.SimpleChain.doVisiting(SimpleChain.java:160)
       [junit] at org.jboss.axis.SimpleChain.invoke(SimpleChain.java:123)
       [junit] at org.jboss.webservice.client.ClientEngine.invoke(ClientEngine.java:128)
       [junit] at org.jboss.axis.client.Call.invokeEngine(Call.java:3079)
       [junit] at org.jboss.axis.client.Call.invoke(Call.java:3064)
       [junit] at org.jboss.axis.client.Call.invoke(Call.java:2652)
       [junit] at org.jboss.axis.client.Call.invoke(Call.java:2561)
       [junit] at org.jboss.axis.client.Call.invokeInternal(Call.java:1982)
       [junit] at org.jboss.axis.client.Call.invoke(Call.java:1920)
       [junit] at org.jboss.webservice.client.CallImpl.invoke(CallImpl.java:265)
       [junit] at org.jboss.axis.client.AxisClientProxy.invokeSEIMethod(AxisClientProxy.java:286)
       [junit] at org.jboss.webservice.client.PortProxy.invoke(PortProxy.java:177)
       [junit] at $Proxy3.callHelloProcess(Unknown Source)
       [junit] at org.jbpm.bpel.tutorial.invoker.InvokerTest.testCallHelloProcess(InvokerTest.java:32)
       [junit] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       [junit] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       [junit] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       [junit] at java.lang.reflect.Method.invoke(Method.java:585)
       [junit] at junit.framework.TestCase.runTest(TestCase.java:154)
       [junit] at junit.framework.TestCase.runBare(TestCase.java:127)
       [junit] at junit.framework.TestResult$1.protect(TestResult.java:106)
       [junit] at junit.framework.TestResult.runProtected(TestResult.java:124)
       [junit] at junit.framework.TestResult.run(TestResult.java:109)
       [junit] at junit.framework.TestCase.run(TestCase.java:118)
       [junit] at junit.framework.TestSuite.runTest(TestSuite.java:208)
       [junit] at junit.framework.TestSuite.run(TestSuite.java:203)
       [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:297)
       [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeInVM(JUnitTask.java:1072)
       [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:682)
       [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeOrQueue(JUnitTask.java:1434)
       [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:632)
       [junit] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
       [junit] at org.apache.tools.ant.Task.perform(Task.java:364)
       [junit] at org.apache.tools.ant.Target.execute(Target.java:341)
       [junit] at org.apache.tools.ant.Target.performTasks(Target.java:369)
       [junit] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
       [junit] at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
       [junit] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
       [junit] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
       [junit] at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
       [junit] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
       [junit] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
       [junit] ------------- ---------------- ---------------
       [junit] Testcase: testCallHelloProcess(org.jbpm.bpel.tutorial.invoker.InvokerTest): Caused an ERROR
       [junit] null
       [junit] java.lang.reflect.UndeclaredThrowableException
       [junit] at $Proxy3.callHelloProcess(Unknown Source)
       [junit] at org.jbpm.bpel.tutorial.invoker.InvokerTest.testCallHelloProcess(InvokerTest.java:32)
       [junit] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
       [junit] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
       [junit] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
       [junit] Caused by: java.net.SocketTimeoutException: Read timed out
       [junit] at java.net.SocketInputStream.socketRead0(Native Method)
       [junit] at java.net.SocketInputStream.read(SocketInputStream.java:129)
       [junit] at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
       [junit] at java.io.BufferedInputStream.read(BufferedInputStream.java:235)
       [junit] at org.jboss.axis.transport.http.HTTPSender.readHeadersFromSocket(HTTPSender.java:571)
       [junit] at org.jboss.axis.transport.http.HTTPSender.invoke(HTTPSender.java:135)
       [junit] at org.jboss.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:73)
       [junit] at org.jboss.axis.SimpleChain.doVisiting(SimpleChain.java:160)
       [junit] at org.jboss.axis.SimpleChain.invoke(SimpleChain.java:123)
       [junit] at org.jboss.webservice.client.ClientEngine.invoke(ClientEngine.java:128)
       [junit] at org.jboss.axis.client.Call.invokeEngine(Call.java:3079)
       [junit] at org.jboss.axis.client.Call.invoke(Call.java:3064)
       [junit] at org.jboss.axis.client.Call.invoke(Call.java:2652)
       [junit] at org.jboss.axis.client.Call.invoke(Call.java:2561)
       [junit] at org.jboss.axis.client.Call.invokeInternal(Call.java:1982)
       [junit] at org.jboss.axis.client.Call.invoke(Call.java:1920)
       [junit] at org.jboss.webservice.client.CallImpl.invoke(CallImpl.java:265)
       [junit] at org.jboss.axis.client.AxisClientProxy.invokeSEIMethod(AxisClientProxy.java:286)
       [junit] at org.jboss.webservice.client.PortProxy.invoke(PortProxy.java:177)
       [junit] ... 30 more
       [junit] Test org.jbpm.bpel.tutorial.invoker.InvokerTest FAILED
      BUILD SUCCESSFUL
      Total time: 1 minute 6 seconds
      
      

      and my files:


      invoker.wsdl:
      <?xml version="1.0" encoding="UTF-8"?>
      <definitions targetNamespace="http://jbpm.org/examples/invoker"
      xmlns:tns="http://jbpm.org/examples/invoker"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:plt="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns="http://schemas.xmlsoap.org/wsdl/"
      xsi:schemaLocation="http://schemas.xmlsoap.org/wsdl/
       http://schemas.xmlsoap.org/wsdl/
       http://schemas.xmlsoap.org/ws/2003/05/partner-link/
       http://schemas.xmlsoap.org/ws/2003/05/partner-link/">
       <plt:partnerLinkType name="greeterPLT">
       <plt:role name="greeter">
       <plt:portType name="tns:invokerPT"/>
       </plt:role>
       </plt:partnerLinkType>
       <message name="forwardNameMessage">
       <part name="forwardName" type="xsd:string"/>
       </message>
       <message name="forwardGreetingMessage">
       <part name="forwardGreeting" type="xsd:string"/>
       </message>
       <portType name="invokerPT">
       <operation name="callHelloProcess">
       <input message="tns:forwardNameMessage"/>
       <output message="tns:forwardGreetingMessage"/>
       </operation>
       </portType>
      </definitions>
      
       invoker.bpel:
      <?xml version="1.0" encoding="UTF-8"?>
      <process name="invoker"
      targetNamespace="http://jbpm.org/examples/invoker"
      xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
      xmlns:tns="http://jbpm.org/examples/simpleServiceInvoker"
      xmlns:bpel="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
      xmlns:invokerns="http://jbpm.org/examples/invoker"
      xmlns:hellons="http://jbpm.org/examples/hello"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://schemas.xmlsoap.org/ws/2003/03/business-process/
       http://schemas.xmlsoap.org/ws/2003/03/business-process/">
       <partnerLinks>
       <partnerLink name="clientProcess" partnerLinkType="invokerns:greeterPLT" myRole="greeter"/>
       <partnerLink name="processService" partnerLinkType="hellons:helloPLT" partnerRole="service"/>
       </partnerLinks>
       <!-- The variable part helps to hold, copy, store the message exchanged between the Partners -->
       <variables>
       <variable name="inputProcess" messageType="invokerns:forwardNameMessage"/>
       <variable name="outputProcess" messageType="invokerns:forwardGreetingMessage"/>
       <variable name="inputService" messageType="hellons:nameMessage"/>
       <variable name="outputService" messageType="hellons:greetingMessage"/>
       </variables>
       <sequence name="ReceiveInvokeReply">
       <!--After the instance of this process receives a message this will be put in the inputProcess Container and the invoke-activity will take place. -->
       <receive name="ReceiveNameStringFROMClient" partnerLink="clientProcess" portType="invokerns:invokerPT"
       operation="callHelloProcess" variable="inputProcess" createInstance="yes"/>
       <assign name="forwardNameMessageTONameMessage">
       <copy>
       <from variable="inputProcess" part="forwardName"/>
       <to variable="inputService" part="name"/>
       </copy>
       </assign>
       <!-- The invoke activity will take place. The result of the invokation will then be store in the variable outputService-->
       <invoke name="InvokeHelloProcess" partnerLink="processService" portType="hellons:helloPT"
       operation="sayHello" inputVariable="inputService" outputVariable="outputService"/>
       <assign name="returnCopy">
       <copy>
       <from variable="outputService" part="greeting"/>
       <to variable="outputProcess" part="forwardGreeting"/>
       </copy>
       </assign>
       <reply name="ForwardHelloProcessResponse" partnerLink="clientProcess" portType="invokerns:invokerPT"
       operation="callHelloProcess" variable="outputProcess"/>
       </sequence>
      </process>
      
       hello.wsdl:
      <?xml version="1.0" encoding="UTF-8"?>
      <definitions
      xmlns:tns="http://jbpm.org/examples/hello"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:plt="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns="http://schemas.xmlsoap.org/wsdl/"
      argetNamespace="http://jbpm.org/examples/hello"
      xsi:schemaLocation="http://schemas.xmlsoap.org/wsdl/
       http://schemas.xmlsoap.org/wsdl/
       http://schemas.xmlsoap.org/ws/2003/05/partner-link/
       http://schemas.xmlsoap.org/ws/2003/05/partner-link/">
       <message name="nameMessage">
       <part name="name" type="xsd:string"/>
       </message>
       <message name="greetingMessage">
       <part name="greeting" type="xsd:string"/>
       </message>
       <portType name="helloPT">
       <operation name="sayHello">
       <input message="tns:nameMessage"/>
       <output message="tns:greetingMessage"/>
       </operation>
       </portType>
       <!-- characterizes the relationship between the process and its caller -->
       <plt:partnerLinkType name="helloPLT">
       <plt:role name="service">
       <plt:portType name="tns:helloPT"/>
       </plt:role>
       </plt:partnerLinkType>
      </definitions>
      
       jboss-client.xml:
      <?xml version='1.0' encoding='UTF-8' ?>
      <!DOCTYPE jboss-client PUBLIC "-//JBoss//DTD Application Client 4.0//EN"
       "http://www.jboss.org/j2ee/dtd/jboss-client_4_0.dtd">
      <jboss-client>
       <!-- JNDI name bound to the client's environment context -->
       <jndi-name>invoker-client</jndi-name>
       <service-ref>
       <!-- the service-ref element to configure -->
       <service-ref-name>service/Invoker</service-ref-name>
       <!-- published WSDL file -->
      <wsdl-override>http://localhost:8080/invoker/invoker?wsdl</wsdl-override>
       </service-ref>
      </jboss-client>
      
       webservices.xml
      
      <?xml version="1.0" encoding="UTF-8"?>
      <webservices version="1.1" xmlns="http://java.sun.com/xml/ns/j2ee"
       xmlns:impl="http://www.jbpm.org/examples/invoker"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
       http://java.sun.com/xml/ns/j2ee/j2ee_web_services_1_1.xsd">
       <webservice-description>
      
       <!-- descriptive name for the service -->
       <webservice-description-name>Invoker Service</webservice-description-name>
       <!-- WSDL service file -->
       <wsdl-file>WEB-INF/wsdl/service.wsdl</wsdl-file>
       <!-- Java<->XML mapping file -->
       <jaxrpc-mapping-file>WEB-INF/jaxrpc-mapping.xml</jaxrpc-mapping-file>
      
       <port-component>
       <!-- logical name for the port (unique within the module) -->
       <port-component-name>clientProcessPort</port-component-name>
      
       <!-- WSDL port element (in WSDL implementation file) -->
       <wsdl-port>impl:clientProcessPort</wsdl-port>
      
      
       <!-- service endpoint interface class (step 4.2) -->
       <service-endpoint-interface>
       org.jbpm.bpel.tutorial.invoker.InvokerPT
       </service-endpoint-interface>
      
       <!-- associated servlet (in web-app [web.xml] descriptor) -->
       <service-impl-bean>
       <servlet-link>invokerServlet</servlet-link>
       </service-impl-bean>
       <handler>
      
       <!-- logical name for the handler (unique within the module) -->
       <handler-name>invokerHandler</handler-name>
       <!-- handler class (in BPEL extension library) -->
       <handler-class>org.jbpm.bpel.service.messager.PortHandler</handler-class>
       <init-param>
       <description>name of the associated partner link which match to myRole </description>
       <param-name>portName</param-name>
       <param-value>clientProcess</param-value>
       </init-param>
       </handler>
       </port-component>
       </webservice-description>
      </webservices>
      
       jboss-web.xml
      
      <?xml version="1.0" encoding="UTF-8" ?>
      <!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 2.4//EN"
       "http://www.jboss.org/j2ee/dtd/jboss-web_4_0.dtd">
      <jboss-web>
       <resource-ref>
       <res-ref-name>jms/ConnectionFactory</res-ref-name>
       <jndi-name>java:ConnectionFactory</jndi-name>
       </resource-ref>
       <message-destination-ref>
      <message-destination-ref-name>jms/clientProcessQueue</message-destination-ref-name>
       <jndi-name>queue/testQueueClientProcess</jndi-name>
       </message-destination-ref>
      </jboss-web>
      
       bpel-application.xml
      
      <?xml version="1.0" encoding="UTF-8"?>
      <bpelApplication name="invoker" xmlns="http://jbpm.org/bpel"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://jbpm.org/bpel
       http://jbpm.org/bpel/bpel_application_1_0.xsd">
       <partnerLinks>
       <partnerLink name="clientProcess">
       <!-- name bound to the queue assigned to this partner link -->
       <myRole destination="jms/clientProcessQueue" />
       </partnerLink>
      
       <!-- WHEN DEPLOYING THE WEBAPPLICATION TO JBOSS THE PARTNERLINKREFERENCE PROCESSSERVICE CAUSE AN.
       WE NEED A PARTNERLINK ELEMENT ONLY FOR PARTNERLINK WHERE THE PROCESS HAS THE MYROLE -->
       <!--partnerLink name="processService"-->
       <!-- name bound to the queue assigned to this partner link -->
       <!--myRole destination="jms/processServiceQueue" />
       </partnerLink-->
       </partnerLinks>
      </bpelApplication>
      
      
       InvokerTest.java
      package org.jbpm.bpel.tutorial.invoker;
      
      import java.util.Properties;
      import javax.naming.InitialContext;
      import javax.naming.NamingException;
      import junit.framework.TestCase;
      
      public class InvokerTest extends TestCase {
      
       private InvokerPT greeter;
      
       public InvokerTest(String forwardName) {
       super(forwardName);
       }
      
       protected void setUp() throws Exception {
       InitialContext ctx = getInitialContext();
       // JNDI name bound to the service interface (in application-client.xml)
       String serviceRefName = "service/Invoker";
       // lookup the service interface in the environment context
       InvokerService service = (InvokerService) ctx.lookup("java:comp/env/" + serviceRefName);
       // obtain the dynamic proxy for the web service port
       greeter = service.getClientProcessPort();
       }
      
       public void testCallHelloProcess() throws Exception {
       String forwardName = "Popeye";
       String forwardGreeting = greeter.callHelloProcess(forwardName);
       assertEquals("Hello, Popeye!", forwardGreeting);
       }
      
       protected InitialContext getInitialContext() throws NamingException {
       // JNDI name bound to the client's environment context (in jboss-client.xml)
       String envContextName = "invoker-client";
       // prepare the enviroment
       Properties env = new Properties();
       env.setProperty("j2ee.clientName", envContextName);
       // the properties in env *and* jndi.properties are placed in the context's environment
       return new InitialContext(env);
       }
      }
      


      Some one has any idee what is wrong in my Junit Test ? Please your urgently help will be very appreciated.

      Best regards

      Bertrand Njipwo