NeedsHelp
NeedsHelp

Reputation: 437

WSO2 BPS / SOAP - How does one get the result of a human task using the HumanTaskClientAPI?

I've tried using getOuputResponse.getTaskData() but it returns an XML and the GetOutcome method apparently isn't supported yet. Is there another method that I'm not seeing or is this the only way?

My code so far:

GetOutput getOutput = new GetOutput();
getOutput.setIdentifier(resultRow[0].getId());

GetOutputResponse output = null;

try {

        output = humanTaskClient.getOutput(getOutput);

    } catch (IllegalOperationFault | IllegalArgumentFault e) {
        e.printStackTrace();
    } catch (IllegalStateFault e) {
        e.printStackTrace();
    } catch (IllegalAccessFault e) {
        e.printStackTrace();
    }

    System.out.println("OUTPUT: " + output.getTaskData());

Upvotes: 0

Views: 57

Answers (1)

Jeroen van Veldhuizen
Jeroen van Veldhuizen

Reputation: 176

You are right, getOutcome() does not work. The output is the XML that you have defined for your task (ie, in the WSDL of the Human Task definition). So you can parse that:

TaskOperationsImpl ops = new TaskOperationsImpl();
String output = (String) ops.getOutput(new URI(taskIdString), null);
DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
dfactory.setNamespaceAware(true);
DocumentBuilder docBuilder = dfactory.newDocumentBuilder();
Node xmldoc = docBuilder.parse(new ByteArrayInputStream(output.getBytes()));

Than you can process the result.

Upvotes: 1

Related Questions