%dw 2.0
output application/java
ns ns0 http://mulesoft.org/tshirt-service
---
{
body: {
ns0#OrderTshirtResponse: {
orderId: "I got a request from " ++ (payload.body.ns0#OrderTshirt.name default "")
}
} write "application/xml"
}
Return a Valid SOAP Response After a Fault
After you resolve the SOAP fault, add Transform Message on the OrderTshirt:\soapkit-config flow and author DataWeave that returns a valid payload instead of another fault. Use the correct namespace so the response matches the WSDL contract and avoids leading fault codes. Transform Message runs after the WSDL endpoint dispatches into your main flow and any backend calls.
-
In Studio, in the OrderTshirt:\soapkit-config flow, open the Transform Message component.
The Transform Message properties window displays the generated DataWeave code.
-
Modify the DataWeave code as follows:
-
Save and rerun the project.
-
In SoapUI, resubmit the request to generate a SOAP fault.
The output changes to a valid response:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns0:OrderTshirtResponse xmlns:ns0="http://mulesoft.org/tshirt-service">
<orderId>I got a request from John</orderId>
</ns0:OrderTshirtResponse>
</soap:Body>
</soap:Envelope>



