1

In SOAPUI tool, in response for any DB step, response contains with tableName.column.

please refer the below image.

screenshot of text

How can remove the tableName attribute from the response. I mean to ask, is there any setting in SOAPUI or is there any properties file I need to update...

albciff
  • 18,112
  • 4
  • 64
  • 89
HemaSundar
  • 1,263
  • 3
  • 17
  • 28
  • You can use string replacement using groovy script. – Rao Jul 08 '16 at 11:17
  • This is an internal XML representation of the data. There is no switch to modify this behaviour. This is by design: If you `JOIN` two tables as part of your statement, then the XML representation would be unclear as to which table your data is coming from. – SiKing Jul 08 '16 at 15:32
  • 1
    Also: it is preferred to post text as text, rather than converting it to an image. – SiKing Jul 08 '16 at 15:39
  • What exactly are you trying to do? why do you wanted to remove? If there is better context about the use case, then it will be better for some one to reply. – Rao Jul 08 '16 at 17:29
  • @Rao Thanks for the reply. Actually for customer side people it is displaying without tableName. They are saying they didn't change any default settings. As we have to work together, it is becoming difficult to maintain XPATHs in assertions. – HemaSundar Jul 09 '16 at 18:47
  • @SiKing thanks for the Reply – HemaSundar Jul 09 '16 at 18:48
  • @HemaSundar for me also the table names are not displayed (with joins or not)... and I don't remember to touch any settings related with that. I'm only guessing but maybe this depends on driver implementation? Probably soapui internally constructs the response XML for the jdbc step getting the node name from `ResultSetMetaData rsmd = rs.getMetaData(); String name = rsmd.getColumnName(1);` or something like that... which relay on jdbc vendor implementation... check that you've the same jar driver version than the client on `SOAPUI_HOME/bin/ext`. – albciff Jul 13 '16 at 10:32

2 Answers2

1

This doesn't depends on settings from SOAPUI, it's depends on DB drivers.

I follow the SOAPUI code from github, and I finally found that internally JDBCTestSteps constructs the XML node names from response based on the follow code fragment:

...
public static Document addResultSetXmlPart(Element resultsElement, ResultSet rs, Document xmlDocumentResult)
            throws SQLException {
ResultSetMetaData rsmd = rs.getMetaData();
...
...
String columnName = "";
if (!StringUtils.isNullOrEmpty(rsmd.getTableName(ii))) {
    columnName += (rsmd.getTableName(ii)).toUpperCase() + ".";
}
columnName += (rsmd.getColumnName(ii)).toUpperCase();
String value = rs.getString(ii);
Element node = xmlDocumentResult.createElement(StringUtils.createXmlName(columnName));
...

(You can see the whole method addResultSetXmlPart method form XMLUtils class here)

So as you can see the node name on the XML depends on ResultSetMetaData getTableName and getColumnName methods. This class is an interface and the implementation of these methods depends on specific DB driver version.

So to have the same behavior as your client, simply check that both have the same DB drivers in SOAPUI_HOME\bin\ext.

REMARK: Once you or your client change the .jar in SOAPUI_HOME\bin\ext restart SOAPUI in order to load the new ones.

Hope this helps,

albciff
  • 18,112
  • 4
  • 64
  • 89
1

"postgresql-9.1-903.jdbc4" should return the resultset without the table names. I got it working without placing the db driver to the SOAPUI_HOME\bin\ext.