Companion is a docker image you can install to your Windows/Mac/Linux that will give you tools like "Flow Diff", "Credentials Where-used", "Flow Image".
Getting SOAP Error Body
You are using SOAP adapter and when service returns SOAP Fault, you want to catch, use, or log the exception payload.
This method explained in a blog post in SAP Community.
The exception payload will be included in message property CamelExceptionCaught
and has the type org.apache.cxf.binding.soap.SoapFault
.
To see all available methods in this class see the Javadoc
Groovy IDE notice
You can't test this example with GroovyIDE at the moment.
Script
Try it on
import com.sap.gateway.ip.core.customdev.util.Message;
import java.util.HashMap;
import org.w3c.dom.Node;
import groovy.xml.*
def Message processData(Message message) {
def map = message.getProperties();
def ex = map.get("CamelExceptionCaught");
if (ex.getClass().getCanonicalName().equals("org.apache.cxf.binding.soap.SoapFault")) {
// log, use, or set to body
// You can also get statusCode or Message
// String exceptionMessage = ex.getMessage();
// Fault Detail Element
def xml = XmlUtil.serialize(ex.getOrCreateDetail());
message.setBody(xml);
}
return message;
}