---
schema_version: "1"
id: d1abfefd7864b689720faf88b653f87b6a59522cb0e3bf233da50684f4b4d287
title: Return a Valid SOAP Response After a Fault
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/apikit/latest/apikit-4-prevent-fault-task.md
canonical_url: https://docs.mulesoft.com/apikit/latest/apikit-4-prevent-fault-task
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 5500ba44e86a4339e624102b0dd74f22da58e1817b109bad6dfb0dab4a42bced
description: MuleSoft Documentation Site
release: 4.x
latest: true
---
---
product: APIkit
version: 4.x
is-latest-version: true
---

# Return a Valid SOAP Response After a Fault

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

After you resolve the [SOAP fault](https://docs.mulesoft.com/apikit/latest/apikit-4-soap-fault-task), 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.

1.  In Studio, in the **OrderTshirt:\\soapkit-config** flow, open the Transform Message component.

    The Transform Message properties window displays the generated DataWeave code.

2.  Modify the DataWeave code as follows:

    ```raml
    %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"
    }
    ```

3.  Save and rerun the project.

4.  In SoapUI, resubmit the request to generate a SOAP fault.

    The output changes to a valid response:

```xml
<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>
```

## See Also

- [Display a Typed SOAP Fault](https://docs.mulesoft.com/apikit/latest/apikit-4-display-fault-task)
