This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Default Values Sample

Note that WSO2 EI is shipped with the following changes to what is mentioned in this documentation:

  • <PRODUCT_HOME>/repository/samples/ directory that includes all Data Integration samples is changed to <EI_HOME>/samples/data-services/.
  • <PRODUCT_HOME>/repository/samples/resources/ directory that includes all artifacts related to the Data Integration samples is changed to <EI_HOME>/samples/data-services/resources/.

This example demonstrates how default values specified in the .dbs file of the data service will be used when specific values are not given for some fields. In the RDBMS Sample service, a default employee salary is specified as 1500 in the .dbs file as shown below.

<param defaultValue="1500" name="salary" ordinal="5" paramType="SCALAR" sqlType="DOUBLE" type="IN"/>

Therefore, when you use the "addEmployee" operation to add a new employee, if you do not specify an explicit salary value for the employee, the default salary will be added. For example, execute the "addEmployee" operation with the following parameter settings:

  • employeeNumber=6002;
  • lastName=Smith; 
  • firstName=John; 
  • email=john@smith.com
  • Remove <xs:salary xmlns:xs="http://ws.wso2.org/dataservice/samples/rdbms_sample"></xs:salary> from the operation to make sure that a salary value is not added.

Now, when you execute the "addEmployee" operation, the result will be the following:

Note that the "salary" value is set to 1500. This is the default value for that field as specified in the .dbs file of the data service.