簡體   English   中英

WSO2 BPS / SOAP-如何使用HumanTaskClientAPI獲得人工任務的結果?

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

我嘗試使用getOuputResponse.getTaskData()但是它返回XML,並且顯然尚不支持GetOutcome方法。 有沒有我看不到的另一種方法,或者這是唯一的方法嗎?

到目前為止,我的代碼:

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());

沒錯,getOutcome()不起作用。 輸出是您為任務定義的XML(即,在“人工任務”定義的WSDL中)。 因此,您可以解析:

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()));

比您可以處理結果。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM