[jboss-user] [jBPM] - calling Java method from Service Task with multiple input parameters

Jeff Kouba do-not-reply at jboss.com
Mon Dec 5 16:41:21 EST 2011


Jeff Kouba [http://community.jboss.org/people/jkouba] created the discussion

"calling Java method from Service Task with multiple input parameters"

To view the discussion, visit: http://community.jboss.org/message/639918#639918

--------------------------------------------------------------
How do you call a Java method from a service task that has more than one input parameters? For instance, two strings?

What would the interface xml look like? For instance, this works when MyMethod just takes one string as an input parameter:

public String MyMethod(String inputString)

<itemDefinition id="_4_InMessageType" structureRef="java.lang.String" />
  <message id="_4_InMessage" itemRef="_4_InMessageType" />
  <interface id="_4_ServiceInterface" name="com.test.MyService">
    <operation id="_4_ServiceOperation" name="MyMethod">
      <inMessageRef>_4_InMessage</inMessageRef>
    </operation>
  </interface>

But how would you define the interface if it takes two strings as input?

public String MyMethod(String inputString1, String inputString2)

I tried something like this without success...

<itemDefinition id="_4_InMessageType" structureRef="java.lang.String" />
  <message id="_4_InMessage" itemRef="_4_InMessageType" />
  <message id="_4_InMessage2" itemRef="_4_InMessageType" />
<interface id="_4_ServiceInterface" name="com.test.MyService">  
    <operation id="_4_ServiceOperation" name="MyMethod">
      <inMessageRef>_4_InMessage</inMessageRef>
      <inMessageRef>_4_InMessage2</inMessageRef>
    </operation>
  </interface>

with the service task being

<serviceTask id="_4" name="MyService" operationRef="_4_ServiceOperation" implementation="Other" >
      <ioSpecification>
        <dataInput id="_4_param1Ref" name="Parameter" />
        <dataInput id="_4_param2Ref" name="Parameter" />
        <dataOutput id="_4_result" name="Result" />
        <inputSet>
          <dataInputRefs>_4_param1Ref</dataInputRefs>
          <dataInputRefs>_4_param2Ref</dataInputRefs>
        </inputSet>
        <outputSet>
          <dataOutputRefs>_4_result</dataOutputRefs>
        </outputSet>
      </ioSpecification>
      <dataInputAssociation>
        <sourceRef>ipAddress</sourceRef>
        <targetRef>_4_param1Ref</targetRef>
      </dataInputAssociation>
      <dataInputAssociation>
         <sourceRef>serialInterface</sourceRef>
         <targetRef>_4_param2Ref</targetRef>
      </dataInputAssociation>
      <dataOutputAssociation>
        <sourceRef>_4_result</sourceRef>
        <targetRef>thisResult</targetRef>
      </dataOutputAssociation>
    </serviceTask>

thanks...
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/639918#639918]

Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20111205/991806fb/attachment.html 


More information about the jboss-user mailing list