Handling the validation data returned

Whenever the Bank Wizard web service has completed a validation, it returns data in XML format. The exact data returned will depend on the type of call made and whether the call was successful. The data types that can be returned are:

Depending on your requirements, you can either display all of the information returned or specific fields.

This example shows how you can use an array to display all of the validation conditions returned by Bank Wizard.

ArrayList arrayErrors = actionBean.getErrors();

/* Make sure at least one condition has been returned and display a heading */

if (arrayErrors != null && arrayErrors.size() > 0) {

System.out.println("Conditions returned");

/* Loop through array displaying each condition on a separate line */

for ( int i = 0; i < arrayErrors.size(); i++) {

out.println(  arrayErrors.get(i) + "<br>");

}

}

This example shows how you can display all of the standard branch data. This also retrieves and displays the field names, therefore supporting multiple countries.

/* Display the fields from the basic branch data */

Details[] details = response.getBranchData().getDetails();

for(int i = 0; i < details.length; i++) {

/* Retrieve and display the field name and value */

String name = details[i].getFieldname();

String value = details[i].getFieldvalue();

System.out.println(name  + " = " + value);

}

To display specific information, you extract the required field from the data. For branch data you do this by extracting the required parameter, and for all other information you extract the specific field.

This example shows how you display the Payment Routing BIC, PO Box number, Branch BIC and SWIFT category.

out.println("<tr><td>Payment Routing BIC</td><td>" + actionBean.extractFromSubBranchData(myInt,"7") + "</td></tr>");

out.println("<tr><td>PO BOX Number</td><td>" + actionBean.extractFromSubBranchData(myInt,"53") + "</td></tr>");

out.println("<tr><td>Branch BIC</td><td>" + actionBean.extractFromSubBranchData(myInt,"5") + "</td></tr>");

out.println("<tr><td>SWIFT Category</td><td>" + actionBean.extractFromSubBranchData(myInt,"67") + actionBean.extractFromSubBranchData(myInt, "68") + "</td></tr>");