} else if (SOAP12_STRING.equals(version.getAttributeValue())) {
soapVersion = SOAP12;
} else if (POX_STRING.equals(version.getAttributeValue())) {
soapVersion = POX;
} else {
throw new MediatorException("Invalid SOAP version");
}
}
OMAttribute response = elem.getAttribute(ATT_RESPONSE_Q);
if (response != null) {
if ("true".equals(response.getAttributeValue())) {
markAsResponse = true;
} else if ("false".equals(response.getAttributeValue())) {
markAsResponse = false;
} else {
throw new MediatorException("Invalid value '" + response.getAttributeValue()
+ "' passed as response. Expected 'true' or 'false'");
}
serializeResponse = true;
}
OMElement code = elem.getFirstChildWithName(CODE_Q);
if (code != null) {
OMAttribute value = code.getAttribute(ATT_VALUE);
OMAttribute expression = code.getAttribute(ATT_EXPRN);
if (value != null) {
String strValue = value.getAttributeValue();
String prefix = null;
String name = null;
if (strValue.indexOf(":") != -1) {
prefix = strValue.substring(0, strValue.indexOf(":"));
name = strValue.substring(strValue.indexOf(":")+1);
} else {
throw new MediatorException("A QName is expected for fault code as prefix:name");
}
String namespaceURI = OMElementUtils.getNameSpaceWithPrefix(prefix, code);
if (namespaceURI == null) {
throw new MediatorException("Invalid namespace prefix '" + prefix + "' in code attribute");
}
faultCodeValue = new QName(namespaceURI, name, prefix);
} else if (expression != null) {
try {
faultCodeExpr = SynapseXPathFactory.getSynapseXPath(code, ATT_EXPRN);
} catch (JaxenException je) {
throw new MediatorException("Invalid fault code expression : " + je.getMessage());
}
} else {
throw new MediatorException("A 'value' or 'expression' attribute must specify the fault code");
}
} else if (soapVersion != POX) {
throw new MediatorException("The fault code is a required attribute for the " +
"makefault mediator unless it is a pox fault");
}
OMElement reason = elem.getFirstChildWithName(REASON_Q);
if (reason != null) {
OMAttribute value = reason.getAttribute(ATT_VALUE);
OMAttribute expression = reason.getAttribute(ATT_EXPRN);
if (value != null) {
faultReasonValue = value.getAttributeValue();
} else if (expression != null) {
try {
faultReasonExpr = SynapseXPathFactory.getSynapseXPath(reason, ATT_EXPRN);
} catch (JaxenException je) {
throw new MediatorException("Invalid fault reason expression : " + je.getMessage());
}
} else {
throw new MediatorException("A 'value' or 'expression' attribute must specify the fault code");
}
} else if (soapVersion != POX) {
throw new MediatorException("The fault reason is a required attribute for the " +
"makefault mediator unless it is a pox fault");
}
// after successfully creating the mediator
// set its common attributes such as tracing etc
processAuditStatus(this, elem);
OMElement node = elem.getFirstChildWithName(NODE_Q);
if (node != null && node.getText() != null) {
try {
faultNode = new URI(node.getText());
} catch (URISyntaxException e) {
throw new MediatorException("Invalid URI specified for fault node : " + node.getText());
}
}
OMElement role = elem.getFirstChildWithName(ROLE_Q);
if (role != null && role.getText() != null) {
try {
faultRole = new URI(role.getText());
} catch (URISyntaxException e) {
throw new MediatorException("Invalid URI specified for fault role : " + role.getText());
}
}
OMElement detail = elem.getFirstChildWithName(DETAIL_Q);
if (detail != null) {
OMAttribute detailExpr = detail.getAttribute(ATT_EXPRN);
if (detailExpr != null && detailExpr.getAttributeValue() != null) {
try {
faultDetailExpr = SynapseXPathFactory.getSynapseXPath(detail, ATT_EXPRN);
} catch (JaxenException e) {
throw new MediatorException("Unable to build the XPath for fault detail " +
"from the expression : " + detailExpr.getAttributeValue());
}
} else if (detail.getFirstOMChild() != null) {
OMNode detailNode = detail.getFirstOMChild();
if (detailNode instanceof OMText) {