Hide Forgot
Description of problem: I just wanted to call an add operation for calculator which requires 2 parameters, x and y. http://soaptest.parasoft.com/calculator.wsdl First I tried to set an array of parameters for web service operation through the process variable and it didn't work https://bugzilla.redhat.com/show_bug.cgi?id=1024946 . So I've changed it to set the variable in script task like this: kcontext.setVariable("parameters", new Float[]{9.0f, 12.0f}); When I run it, it will throw java.lang.ClassCastException: [Ljava.lang.Float; cannot be cast to java.lang.Float on the line https://github.com/droolsjbpm/jbpm/blob/master/jbpm-workitems/src/main/java/org/jbpm/process/workitem/webservice/WebServiceWorkItemHandler.java#L92 When I change the set variable command to use just one float, it will fail with java.lang.IndexOutOfBoundsException: Index: 1, Size: 1 which is obvious because it requires 2 parameters. The problem is that you consider parameter to be something of type Object https://github.com/droolsjbpm/jbpm/blob/master/jbpm-workitems/src/main/java/org/jbpm/process/workitem/webservice/WebServiceWorkItemHandler.java#L81 but an array cannot be used like an object - if you run the example below it will print [Ljava.lang.Float;@39c931fb instead of 9.0 12.0 public static void main(String[] args) { Object o = new Float[]{9.0f, 12.0f}; test(o); } public static void test(Object... array) { for (Object o : array) { System.out.println(o); } } so I recommend to change the call to something like: if (o instanceof Object[]) { test((Object[])o); } else { test(o); }
fixed to support both Object[] and arrays of primitives jbpm master: https://github.com/droolsjbpm/jbpm/commit/83cc7e669ee57357a8160b9a91e2454f88192b76 6.0.x: https://github.com/droolsjbpm/jbpm/commit/5183d286a73db5874d967e1b49b408f4ac0595c2
Verified in BPMS 6.0.0.ER5