I have a question about best practices. Let's say I have a web method that returns
employee id and
employee name. Now, since I am new to Web Service,we( client(C#) and I(
Java)) agreed upon a return type List<
String> and String format is "employee id,employee name". All is well so far. Program runs and it does the job.
Now, the other day, I was having conversation about return type with another developer and she suggested the way I am returning the data is not right instead I should return String in XML format so the typical output may look like (here without formatting),
I argued that, in this case, you're returning more than 50% non-data(XML tags) to client which is unnecessary. And she argued back that in case of unobvious scenarios like, user does not have permission to access something or there is nothing to return but the error code or something went wrong on server i.e when you need to return something else other than actual data itself, XML string is helpful since you can insert <error> tag. And it's a valid argument so can somebody with good experience with Web Service shed some light here?