A Java-based SOAP worker for Orkes Conductor that extends HTTP worker functionality to handle SOAP calls with automatic JSON/XML conversion.
- JSON to XML Conversion: Automatically converts JSON payloads to XML format
- SOAP Envelope Wrapping: Wraps payloads in standard SOAP envelope
- HTTP POST Support: Makes SOAP calls via HTTP POST (as SOAP requires)
- Dual Response Format: Returns both raw XML and converted JSON responses
- Flexible Input: Accepts both JSON and XML payloads
- Java 23 or higher
- Gradle 8.10 or higher
- Orkes Conductor account with API credentials
./gradlew buildOr on Windows:
gradlew.bat buildThis will create a JAR file in the build/libs/ directory with all dependencies included.
To create a fat JAR (with all dependencies):
./gradlew jarRun the unit tests:
./gradlew testThe tests verify all core functionality:
- JSON to XML conversion
- XML payload handling (no conversion)
- SOAP envelope wrapping
- HTTP POST requests
- Response with both XML and JSON output
The worker can be configured using environment variables or system properties:
CONDUCTOR_SERVERorconductor.server: Conductor server URL (default:https://api.orkes.io/api)CONDUCTOR_KEYorconductor.key: Your Conductor API key (required)CONDUCTOR_SECRETorconductor.secret: Your Conductor API secret (required)WORKER_THREAD_COUNTorworker.thread.count: Number of worker threads (default:10)
export CONDUCTOR_SERVER="https://api.orkes.io/api"
export CONDUCTOR_KEY="your-api-key"
export CONDUCTOR_SECRET="your-api-secret"
java -jar build/libs/soap-worker-1.0.0.jarOr with system properties:
java -Dconductor.server=https://api.orkes.io/api \
-Dconductor.key=your-api-key \
-Dconductor.secret=your-api-secret \
-jar build/libs/soap-worker-1.0.0.jarBefore using the worker, you need to define the task in Orkes Conductor:
- Navigate to Definitions > Task in the Conductor UI
- Click Define task
- Set the Name to
SOAP - Set the Type to
SIMPLE - Configure other parameters as needed
- Save the task
The SOAP worker accepts the following input parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
url |
String | Yes | The SOAP endpoint URL |
payload |
String | Yes | The request payload (JSON or XML string) |
isJson |
Boolean | No | Whether the payload is JSON (default: true) |
soapAction |
String | No | SOAPAction header value |
headers |
String | No | Additional HTTP headers as JSON string (e.g., {"Authorization": "Bearer token"}) |
The worker returns a map with the following keys:
xml: Raw XML response from the SOAP servicejson: JSON representation of the XML responseerror: Error message (only present if an error occurred)
{
"url": "https://example.com/soap-service",
"payload": "{\"name\": \"John\", \"age\": 30}",
"isJson": true,
"soapAction": "http://example.com/GetUser"
}{
"url": "https://example.com/soap-service",
"payload": "<user><name>John</name><age>30</age></user>",
"isJson": false,
"soapAction": "http://example.com/GetUser"
}{
"url": "https://example.com/soap-service",
"payload": "{\"name\": \"John\", \"age\": 30}",
"isJson": true,
"soapAction": "http://example.com/GetUser",
"headers": "{\"Authorization\": \"Bearer token123\", \"X-Custom-Header\": \"value\"}"
}- Input Processing: The worker receives a task with a payload (JSON or XML)
- Conversion: If the payload is JSON, it's converted to XML format
Note: The JSON to XML conversion is a direct, simple conversion without any intelligence or schema mapping. The JSON structure is converted directly to XML elements (e.g.,
{"name": "John"}becomes<name>John</name>). For complex use cases or specific SOAP schema requirements, you may want to customize theconvertJsonToXmlmethod inSoapWorker.javato implement your own conversion logic. - SOAP Envelope: The XML payload is wrapped in a standard SOAP envelope:
<?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Body> <!-- Your payload here --> </soapenv:Body> </soapenv:Envelope>
- HTTP POST: Makes an HTTP POST request to the specified URL with:
Content-Type: text/xml; charset=UTF-8SOAPActionheader (if provided)- Any additional custom headers
- Response Processing:
- Returns the raw XML response
- Converts the XML response to JSON format
- Output: Returns both XML and JSON in the task output
If an error occurs during execution:
- The
errorfield will contain the error message - Both
xmlandjsonfields will benull - The error is also logged for debugging
Make sure your Conductor application has:
- Worker role enabled
- Execute permission for the
SOAPtask
This project is provided as-is for use with Orkes Conductor.