]
Kevin Conner closed JBESB-2453.
-------------------------------
Resolution: Duplicate Issue
soapUI SOAP client: Remove "empty" elements
-------------------------------------------
Key: JBESB-2453
URL:
https://jira.jboss.org/jira/browse/JBESB-2453
Project: JBoss ESB
Issue Type: Feature Request
Security Level: Public(Everyone can see)
Components: Web Services
Affects Versions: 4.5
Reporter: Tom Fennelly
Fix For: 4.x
This is a contribution from Kurt Stam.
This is a mod to SoapUIClientService that automatically removes elements for which there
are no values in the supplied data model. As Kurt pointed out... we may need to make it
more configurable e.g. turn it off by default... add some control of which message
elements are removed when empty etc.
The change was to the injectParameters() method:
private void injectParameters(Element element, Map params, String soapNs) {
NodeList children = element.getChildNodes();
int childCount = children.getLength();
for (int i = 0; i < childCount; i++) {
Node node = children.item(i);
if (childCount == 1 && node.getNodeType() == Node.TEXT_NODE) {
if (node.getTextContent().equals("?")) {
String ognl = OGNLUtils.getOGNLExpression(element, soapNs);
Object param;
param = OGNLUtils.getParameter(ognl, params);
element.removeChild(node);
if (! "".equals(param)) {
element.appendChild(element.getOwnerDocument().createTextNode(param.toString()));
} else {
element.getParentNode().removeChild(element);
}
}
} else if (node!=null && node.getNodeType() == Node.ELEMENT_NODE) {
injectParameters((Element) node, params, soapNs);
}
}
element.removeAttributeNS(OGNLUtils.JBOSSESB_SOAP_NS, IS_CLONE_ATTRIB);
element.removeAttributeNS(OGNLUtils.JBOSSESB_SOAP_NS, OGNLUtils.OGNL_ATTRIB);
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: