As the returned message says, the argument caused the trouble was the fault argument, which is of type MethodFault. According to the API reference, the fault argument is really optional. But my guess is that when you give a state of error, the fault argument becomes required. So this is really conditionally optional. So to fix the problem, you may want to pass in fault argument.
Steve, author of vSphere and VI SDK, creator of open source vijava API managing vSphere, http://www.doublecloud.org
Even we hit the same problem for vSphere 5.1 (using VI-Java 5.0.1).
As u suggested, we tried to pass a "fault" paramerer as follows.
(VI Java setTaskState() API takes LocalizedMethodFault object as parameter.)
LocalizedMethodFault fault = new LocalizedMethodFault();
MethodFault methodFault = new MethodFault();
task.setTaskState(TaskInfoState.error, null, fault);
Still, the above line is throwing exception.
And though the task is getting marked as failed/error, but the status field shows "MessageFault.summary".
Our requirement is simple - just mark the task as Failed/Error.
Is there any way to achieve that?
Did you manage to solve this issue?