localization - Where/how do I localize exceptions raised in a web service? -
Assume that I have a web service that provides a collection of images based on the passage of the user. Now I call the web service with an invalid user. The call throws an unauthorized access exception with a message in which the user is not authorized to obtain the archive.
I think this message should be localized. Based on the error code on the client-side, can I localize this message? Or can I pass the 'language' parameter in the first place? Do I use the HTTP status code so that the customer can localize the message?
The error code is as bad as returning to the web services in general, and for the same reason - If you call service providers, all callers are required to check the error code, then some callers will fail to do so.
You should throw an exception in service. Those exceptions will be converted into SOAP defects. On the client, these will appear as exceptions (for at least .NET clients). If you choose to display the message property of these exceptions, it is for you if you choose to display it, then it is also localization for you - on the client.
Idea - Otherwise, you have to tell the service to the client's culture, it would be better to keep that information on the client only send local text to the customer back to the client.
Comments
Post a Comment