invoke example
joshua_hj Nov 25, 2005 6:39 AMDear Community,
Can anybody provide an example on how to use an invoke operation. I am having problems with the invoke operation. The engine complain with a BPEL Fault, uninitializedPartnerRole
My BPEL code is:
<?xml version="1.0" encoding="UTF-8"?> <process name="helloWorld" targetNamespace="http://jbpm.org/examples/hello" xmlns:tns="http://jbpm.org/examples/hello" xmlns:bpel="http://schemas.xmlsoap.org/ws/2003/03/business-process/" 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/" xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/" xmlns:impl="http://myapp.com" > <partnerLinks> <!-- realizes the abstract relationship with the caller --> <partnerLink name="caller" partnerLinkType="tns:ROinPLT" myRole="service"/> <!--<partnerLink name="sendData" partnerLinkType="tns:ROinsendDataPLT" myRole="service"/>--> <partnerLink name="getData" partnerLinkType="tns:GoandGetLink" partnerRole="service"/> </partnerLinks> <variables> <!-- holds the incoming message --> <variable name="processID" messageType="tns:processIDMessage"/> <!-- holds the outgoing message --> <variable name="return" messageType="tns:returnMessage"/> <variable name="getDataInput" messageType="impl:getDataRequest"/> <variable name="getDataOutput" messageType="impl:getDataResponse"/> </variables> <sequence> <!-- receive a message carrying the name of a person --> <receive operation="initiate" partnerLink="caller" portType="tns:ROinPT" variable="processID" createInstance="yes"/> <!-- compose a greeting phrase containing the name --> <!--<assign> <copy> <from expression="concat('Hello, ', bpel:getVariableData('processID', 'processID'), '!')"/> <to variable="return" part="return"/> </copy> </assign>--> <assign name="copyID1"> <copy> <from expression="bpel:getVariableData('processID', 'processID')"/> <to variable="return" part="return"/> </copy> </assign> <assign name="copyID"> <copy> <from expression="bpel:getVariableData('processID', 'processID')"/> <to variable="getDataInput" part="in0"/> </copy> </assign> <invoke name="getData" inputVariable="getDataInput" partnerLink="getData" operation="getData" portType="impl:GoandGet" outputVariable="getDataOutput"> </invoke> <!--<assign name="copygetDataOutput"> <copy> <from variable="getDataOutput"/> <to variable="return" part="return"/> </copy> </assign>--> <!-- reply with a message carrying the greeting --> <reply operation="initiate" partnerLink="caller" portType="tns:ROinPT" variable="return"/> </sequence> </process>
my wsdl files is:
<?xml version="1.0" encoding="UTF-8"?> <definitions targetNamespace="http://jbpm.org/examples/hello" xmlns:tns="http://jbpm.org/examples/hello" xmlns:impl="http://myapp.com" 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/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:bpel="http://schemas.xmlsoap.org/ws/2003/03/business-process/" xsi:schemaLocation="http://schemas.xmlsoap.org/wsdl/ "> <import namespace="http://myapp.com" location="http://localhost:8080/ws4ee-jbpm2/exactpath/jse?wsdl"/> <!--<import namespace="http://myapp.com" location="services/goandget.wsdl"/>--> <plt:partnerLinkType name="GoandGetLink"> <plt:role name="service"> <plt:portType name="impl:GoandGet"/> </plt:role> </plt:partnerLinkType> <!-- characterizes the relationship between the process and its caller --> <plt:partnerLinkType name="ROinPLT"> <plt:role name="service"> <plt:portType name="tns:ROinPT"/> </plt:role> </plt:partnerLinkType> <message name="processIDMessage"> <part name="processID" type="xsd:string"/> </message> <message name="returnMessage"> <part name="return" type="xsd:string"/> </message> <portType name="ROinPT"> <operation name="initiate"> <input message="tns:processIDMessage"/> <output message="tns:returnMessage"/> </operation> </portType> <!-- carries the name of a person --> <!-- carries the greeting --> <!-- describes the interface presented to callers --> </definitions>
and the bpel-definition file is:
<?xml version="1.0" encoding="UTF-8"?> <!-- specifies the location of the process definition --> <bpelDefinition location="hello.bpel" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jbpm.org/bpel http://jbpm.org/bpel/bpel_definition_1_0.xsd" xmlns="http://jbpm.org/bpel" > <!-- makes WSDL interface elements available to the process --> <imports> <wsdl namespace="http://jbpm.org/examples/hello" location="hello.wsdl"/> <wsdl namespace="http://myapp.com" location="http://localhost:8080/ws4ee-jbpm2/exactpath/jse?wsdl"/> <!--<wsdl namespace="http://myapp.com" location="C:\Java\jbpm-bpel-1.0-alpha3\doc\examples\hello\definition\services\goandget.wsdl"/>--> </imports> </bpelDefinition>
As you can see the deploy goes ok, but whet i try to run the client i get this exception
11:30:00,683 INFO [EARDeployer] Init J2EE application: file:/C:/Java/jboss-4.0.2/server/bpel/deploy/hello-application.ear 11:30:01,003 INFO [TomcatDeployer] deploy, ctxPath=/hello, warUrl=file:/C:/Java/jboss-4.0.2/server/bpel/tmp/deploy/tmp4892hello-application.ear-contents/hello- web-exp.war/ 11:30:02,816 INFO [[/hello]] messagerServlet: BPEL application started: helloWorld 11:30:02,916 INFO [WSDLFilePublisher] WSDL published to: file:/C:/Java/jboss-4.0.2/server/bpel/data/wsdl/hello-application.ear/hello-web.war/service.wsdl 11:30:02,996 INFO [AxisService] WSDD published to: C:\Java\jboss-4.0.2\server\bpel\data\wsdl\hello-application.ear\hello-web.war\callerPort.wsdd 11:30:02,996 INFO [AxisService] Web Service deployed: http://runner:8080/hello/caller 11:30:03,056 INFO [EARDeployer] Started J2EE application: file:/C:/Java/jboss-4.0.2/server/bpel/deploy/hello-application.ear 11:30:37,886 ERROR [StartListener] could not deliver request org.jbpm.bpel.exe.Fault: BPEL Fault, name={http://schemas.xmlsoap.org/ws/2004/03/business-process/}uninitializedPartnerRole at org.jbpm.bpel.service.messager.MessagerSession.getPortCaller(MessagerSession.java:120) at org.jbpm.bpel.service.messager.MessagerSession.invoke(MessagerSession.java:136) at org.jbpm.bpel.service.def.Invoker.invoke(Invoker.java:80) at org.jbpm.bpel.def.Invoke.execute(Invoke.java:27) at org.jbpm.bpel.def.Activity.enter(Activity.java:79) at org.jbpm.graph.def.Transition.take(Transition.java:92) at org.jbpm.graph.def.Node.leave(Node.java:349) at org.jbpm.bpel.def.Activity.leave(Activity.java:118) at org.jbpm.bpel.def.Assign.execute(Assign.java:36) at org.jbpm.bpel.def.Activity.enter(Activity.java:79) at org.jbpm.graph.def.Transition.take(Transition.java:92) at org.jbpm.graph.def.Node.leave(Node.java:349) at org.jbpm.bpel.def.Activity.leave(Activity.java:118) at org.jbpm.bpel.def.Assign.execute(Assign.java:36) at org.jbpm.bpel.def.Activity.enter(Activity.java:79) at org.jbpm.graph.def.Transition.take(Transition.java:92) at org.jbpm.graph.def.Node.leave(Node.java:349) at org.jbpm.bpel.def.Activity.leave(Activity.java:118) at org.jbpm.bpel.def.ProcessInstanceStarter.visit(ProcessInstanceStarter.java:42) at org.jbpm.bpel.def.Receive.accept(Receive.java:63) at org.jbpm.bpel.def.ProcessInstanceStarter.visit(ProcessInstanceStarter.java:81) at org.jbpm.bpel.def.Sequence.accept(Sequence.java:84) at org.jbpm.bpel.def.ProcessInstanceStarter.visit(ProcessInstanceStarter.java:28) at org.jbpm.bpel.def.BpelDefinition.startProcessInstance(BpelDefinition.java:54) at org.jbpm.bpel.service.messager.StartListener.onMessage(StartListener.java:119) at org.jboss.mq.SpyMessageConsumer.run(SpyMessageConsumer.java:707) at java.lang.Thread.run(Thread.java:595)