If a operation in a given web service accept a parameter, which can be in more than one given formats, what is the best practice of handling this scenario (at where do we format the parameter) ?
There are 2 places, where the formatting can be done.
- At the consumer's end
- Within the web service operation
Please make your suggestions.
The following is an example scenario. Suppose that the date of birth is captured by a web application. This consumes a web service. Also assume that those dates are stored in the database in YYYY-MM-DD format. Users are allowed to put a date in the following formats.
- YY-MM-DD
- YYYY-MM-DD
Suppose the date provided by a user is required to be compared with the date stored in the database. As stated above, provided date can be formated within the web application or can be done within the web service code.