Accessing Task Input/Output Schema
To access the input or output element declaration at runtime, you must initialize a mediation task report object
MediationTaskNameReport. This object has the accessor methods to get the input or the output element declaration as
XSDElementDeclaration
.
The following code shows how to get the input or the output element schemas:
public void init() throws TaskLifeCycleFault { } public void destroy() throws TaskLifeCycleFault { } public N execute(final N input, final Exchange<N> exchange) throws TaskFault { <TaskName>MediationTask task = this.getContext().getTaskConfiguration(); TaskName>MediationTaskReport report = new <TaskName>MediationTaskReport(task); /Task input type as schema element declaration XSDElementDeclaration inputType = report.getCustomInputType(); //Task output type as schema element declaration XSDElementDeclaration outputType = report.getCustomOutputType(); return exchange.getMessageData();
Note: The return type of the execute method in a custom mediation task’s runtime class that extends
MediationTaskRT
must be an instance of the output schema defined for the task. If no output schema is defined, output defaults to message data
mediationExchange.getMessageData()
.