Bonita Studio provides connectors which are a specific functions to interact with other services. And here, we will see how we can invoke a SOAP 1.2 based web service at an activity using the connector. In this tutorial, I focus on the WS connector creation instead of the details about workflow design. Hence, you shoud practice the previous TP to be clear with the workflow design before working on this tutorial.
We will design a simple “text processing” workflow. At the Get result step, we will call a web service to process and display a text you give as input. The web service will convert the text into capital letters and separate all letters by a special character called token that you give as input.
Name | Description | Type | Priority |
---|---|---|---|
Enter your word | User enter a text and a token | Human | Normal |
Get result | Convert the text into capital letters and separate the letters with the token using a web service | Service | |
Gate | XOR | ||
Display result | The processed text is displayed to the user | Human | Normal |
no result found | A message is displayed to the user if no result is found | Human | Normal |
Name | Description | Data type |
---|---|---|
wordInput | The user's text | Text |
tokenInput | The user's token | Text |
processedWord | The result of processing the word input | Text |
import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; // Clean response xml document responseDocumentBody.normalizeDocument(); // Get result node NodeList resultList = responseDocumentBody.getElementsByTagNameNS("*", "AllUppercaseWithTokenResult") Element resultElement = (Element) resultList.item(0); String resultData = resultElement.getTextContent(); return resultData;